--------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2500018 Date: 02/03/98 From: NEIL HELLER Time: 07:00pm \/To: ROGER SCUDDER (Read 1 times) Subj: HELP NEEDED RS> FYI, even 4DOS has findfirst, findnext functions. 4DOS doesn't have anything to do with it. Intr 21h function 4Eh is findfirst and function 4Fh is findnext. A programmer in DOS (or any of its siblings such as OS/2) can roll his own and have the same functionality. * KWQ/2 1.2i * --- FLAME v1.1 * Origin: Port Chicago's Loading Dock - 510-676-5359 (1:161/204) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2500019 Date: 02/04/98 From: JOHN DUMAS Time: 08:03pm \/To: ALL (Read 1 times) Subj: DLL GOOD STUFF I have been a pest to a lot of conferences and would like to share the results as simply as possible of what I have found. I have run across so many trying to pass their C code to other languages as I have been. Since strings are the hardest of the normal data types. Example of sending and returning a VB string to a C DLL: ********************************************************************** 'Visual Basic VERSION 4.00 'FORM 1.FRM 1 Private Declare Function GETSTRING Lib "d:\strdll.dll" 2 (ByVal string2send As String) As String 3 Private Sub Command1_Click() 4 string2send = String(255, vbNullChar) 5 returnedstring = String(255, vbNullChar) 6 string2send = "whatever text" 7 returnedstring = GETSTRING(string2send) 8 End Sub ********************************************************************** /* d:\strdll.dll target as win16 DLL OLE2 ON */ #include #include #include 9 extern "C" { 10 char * __far PASCAL __export GetString( char __far *RecievedString ); }; 11 char * __far PASCAL __export GetString( char __far *RecievedString ) { 12 strrev(RecievedString); 13 return(RecievedString); }; ************************************************************************ notes: 1+2 Should be on same line but I broke it to fit on page. 1 "Private" needed will not accept otherwise. 1 "d:\strdll.dll" make sure dll can be found single "\" in VB 1+10 "GETSTRING" changed to "all caps" in DLL so its called that way 2 "ByVal" when sending string is sending a pointer "ByRef" would send a double pointer "VERY TRICKY" 4+5 Space must be reserved "over runs do cause problems" 6 Text to be sent. 7 Function is called. 7 String is returned also since pointer is sent "string2send" is also changed. 9 Keeps name from being mangled. actually just adds a few characters. but its enough to make it unrecognizable. 10 C declare function here goes: return a far character string pointer from a Pascal type exported function named GetString which refers a far character pointer to a string. On a sesame seed bun. 12 String Reverse the string "ABC" becomes "CBA". "BORLAND function" Substitute whatever you want but most compilers have strrev. 13 Send back string. ************************************************************************* Please feel free to use, rip this apart, add comments, and send me comments johnjd@worldnet.att.com ... If you think you're confused now, just wait until I explain it. --- Blue Wave/DOS v2.20 [NR] * Origin: The Witch City BBS *Salem,MA [978]745-1689 *Hayes 28.8 (1:101/301) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2500020 Date: 01/29/98 From: JAVIER KOHEN Time: 07:35am \/To: ALL (Read 1 times) Subj: 3D rotation + perspective ============================================================================= * Forwarded by Javier Kohen (4:900/748.3) * Area : C_ECHO * From : Kurt Kuzba, 1:154/750 (23-Dec-97 22:18:19) * To : Dave Alger * Subj : 3D rotation + perspective ============================================================================= DA> I'm not sure how well it works because I can't get Turbo DA> C++ to load the graphics drivers.... grrr. The .BGI libraries are designed for dynamic linking at runtime. If you want to implement static linking, you will ============================================================================= Does anybody have any idea on implementing DLLs in DOS? Javier Kohen >jkohen@tough.com< [The_Crusher] http://jkohen.base.org +4:900/748.3+ _200:201/126_ ICQ:#3855350# PGPID:*3423EAA9* .!. !!!teG I sdrawkcaB eroM ehT oG I sdrawroF eroM ehT --- Terminate 5.00/Pro * Origin: The King of The Ring (4:900/748.3) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2500021 Date: 01/29/98 From: JAVIER KOHEN Time: 07:37am \/To: KURT KUZBA (Read 1 times) Subj: File-Working 2 On 23-Dec-97, Kurt Kuzba wrote to Paul Poloskov about File-Working 2. KK> Your block read can do this in C also. You only need to specify KK> that it read that much fread(ff, sizeof(my), 1, my_file); This KK> will read a block the size of the struct called my into the memory KK> reserved for the struct labeled ff. I am assuming that you are But you must be careful about paddings inside the structure... it can change from compilation to compilation when you use the correct switches. Javier Kohen >jkohen@tough.com< [The_Crusher] http://jkohen.base.org +4:900/748.3+ _200:201/126_ ICQ:#3855350# PGPID:*3423EAA9* .!. "Call it a hunch." -- Quasimodo --- Terminate 5.00/Pro * Origin: The King of The Ring (4:900/748.3) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2500022 Date: 01/29/98 From: JAVIER KOHEN Time: 07:47am \/To: JOHN RICHARDSON (Read 1 times) Subj: Pointer to a string On 21-Dec-97, John Richardson wrote to Trevor Dennett-Thorpe about Pointer to a string. JR> /* The problem with doing JR> char tst_string[] = "Test string"; JR> is that you are limiting the length of the string and in some JR> cases JR> implying a constant instead you should do this: Nope... you may be (is it "may be"?) implying a constant when you use a pointer to the string literal: 'char *string = "Test string";'. JR> */ JR> char string[256]; /* a better way would to use malloc */ JR> strcpy( string, "Test string" ); Even 'char string[256] = "Test string";' will do. Javier Kohen >jkohen@tough.com< [The_Crusher] http://jkohen.base.org +4:900/748.3+ _200:201/126_ ICQ:#3855350# PGPID:*3423EAA9* .!. "Be careful and have a good time." (a mother's paradox curse) --- Terminate 5.00/Pro * Origin: The King of The Ring (4:900/748.3) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2500023 Date: 01/29/98 From: JAVIER KOHEN Time: 09:02am \/To: ALL (Read 1 times) Subj: Help with libg++ I had a problem with an unrecognized keyword when trying to compile libg++ 2.8.0 with GCC 2.7.2.3 (it DOES compile C++)... I can't remember the exact message, but I guess that I'm not the only one that had this problem. Javier Kohen >jkohen@tough.com< [The_Crusher] http://jkohen.base.org +4:900/748.3+ _200:201/126_ ICQ:#3855350# PGPID:*3423EAA9* .!. "Bother," said Pooh, reading his bank statement from Barings. --- Terminate 5.00/Pro * Origin: The King of The Ring (4:900/748.3) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2500024 Date: 01/29/98 From: JAVIER KOHEN Time: 09:27am \/To: ADAM MAJER (Read 1 times) Subj: 2d rotation On 30-Dec-97, Adam Majer wrote to All about 2d rotation. AM> Can anyone post me a routine for 2-d rotation of a bitmap. My is AM> too slow - cosine and stuff. FWIW, I have some in Pascal, contact by e-mail or netmail on this... BUT, are you using sin/cos tables? Or your routines compute them on each iteration? Javier Kohen >jkohen@tough.com< [The_Crusher] http://jkohen.base.org +4:900/748.3+ _200:201/126_ ICQ:#3855350# PGPID:*3423EAA9* .!. "Be careful and have a good time." (a mother's paradox curse) --- Terminate 5.00/Pro * Origin: The King of The Ring (4:900/748.3) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2500025 Date: 01/29/98 From: JAVIER KOHEN Time: 09:57am \/To: TOM TORFS (Read 1 times) Subj: Program On 29-Dec-97, Tom Torfs wrote to Christian Calonico about Program. TT> Christian Calonico wrote in a message to All: CC>> What's the program you use for sending code in diferent messages? TT> Others have advised you CSplit. This is good advice, and it's even TT> easier if you use this tool together with it [ CPost code deleted for brevity ] Tom... the code didn't make it in its entirety, please repost AND use CSplit ;) Javier Kohen >jkohen@tough.com< [The_Crusher] http://jkohen.base.org +4:900/748.3+ _200:201/126_ ICQ:#3855350# PGPID:*3423EAA9* .!. !!!teG I sdrawkcaB eroM ehT oG I sdrawroF eroM ehT --- Terminate 5.00/Pro * Origin: The King of The Ring (4:900/748.3) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2500026 Date: 01/30/98 From: JAVIER KOHEN Time: 02:01pm \/To: AUKE REITSMA (Read 1 times) Subj: Linked List Stuff in SNIPPETS Hi! Auke, I was using your LL stuff in a personal project, when I found a weird thing. It will work perfectly when using just one list, but when I created a second one, it'll report no more memory; only that this happened with DJGPP 2.01 but it didn't with Borland C... furthermore, even under DJFPP it works right once in a while! What could thid be, DJGPP or LLS? I have LLS v1.01. BTW, DJGPP keeps reporting that enough memory is available even when the program exits with: "Out of memory: LLScreate(LLvendedores).". Here's the snippet: /* (RECEP.001) >>>>>>>>>> CSplit: Version 2.2 >>>>>>>>>> >>>>>>>>>> CSplit: Begin part 1/1 >>>>>>>>>> >>>>>>>>>> CSplit: Begin file RECEP.C >>>>>>>>>> #include #include /* SNIPPETS */ #include struct cliente { int vendedor; char nombre[81]; }; struct vendedor { int clave; }; int main(void) { int LLclientes, LLvendedores; struct cliente tmpClien; struct vendedor tmpVend; LLclientes = LLScreate(sizeof (tmpClien)); if (-1 == LLclientes) { fprintf(stderr, "Out of memory: %s.\n", "LLScreate(LLclientes)"); return (EXIT_FAILURE); } LLvendedores = LLScreate(sizeof (tmpVend)); if (-1 == LLvendedores) { fprintf(stderr, "Out of memory: %s.\n", \ \ "LLScreate(LLvendedores)"); return (EXIT_FAILURE); } LLSdelete(LLclientes); LLSdelete(LLvendedores); return (EXIT_SUCCESS); } >>>>>>>>>> CSplit: End file RECEP.C >>>>>>>>>> >>>>>>>>>> CSplit: End part 1/1 crc: 5dd5 >>>>>>>>>> */ Javier Kohen >jkohen@tough.com< [The_Crusher] http://jkohen.base.org +4:900/748.3+ _200:201/126_ ICQ:#3855350# PGPID:*3423EAA9* .!. "But honey, we _can_ afford it, I just sold your car!" --- Terminate 5.00/Pro * Origin: The King of The Ring (4:900/748.3) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2500027 Date: 02/01/98 From: JAVIER KOHEN Time: 10:35pm \/To: ALL (Read 1 times) Subj: Turbo Vision I FTPed TV 2.0 from Borland's site, but it didn't come with source code, so I wondered where is it available. Thanks. Javier Kohen >jkohen@tough.com< [The_Crusher] http://jkohen.base.org +4:900/748.3+ _200:201/126_ ICQ:#3855350# PGPID:*3423EAA9* .!. !!!teG I sdrawkcaB eroM ehT oG I sdrawroF eroM ehT --- Terminate 5.00/Pro * Origin: The King of The Ring (4:900/748.3)