'=========================================================================== ' Subject: PASSING PARAMS FROM QB TO C Date: 05-14-99 (11:53) ' Author: Ethan Winer Code: Text ' Origin: microsoft.public.basic.dos Packet: FAQS.ABC '=========================================================================== 'From: "Ethan Winer" 'Subject: Re: passing parameter between QB and C 'Newsgroups: microsoft.public.basic.dos 'Date: Wed, 05 May 1999 06:38:24 -0700 > How can i pass a string parameter from c function to QBasic program. C strings are stored in memory with all the characters in sequence, followed by a CHR$(0) byte. The address of the first character is used to identify where the string resides. So from BASIC you need to set aside enough memory to receive the string, plus the zero byte, and pass the address of that memory to the C routine so it knows where to put the string. Then in BASIC you search for the zero byte and keep everything before it. You can set aside memory using: Temp$ = SPACE$(MaxLength + 1) Then pass the address of the temporary string to C using: SADD(Temp$) Finally, when the C routine returns, use INSTR to find the CHR$(0) byte and keep everything up to it: Zero = INSTR(Temp$, CHR$(0))) Result$ = LEFT$(Temp$, Zero - 1) --Ethan Winer