Passing fixed length string to API and is returning nulls in string 
Author Message
 Passing fixed length string to API and is returning nulls in string

Hello all,
  I'm passing a 250 byte fixed length string to a C API call.  After
returning from the call, the string contains my text ....plus extra
junk on the end of the string? are they nulls? how can I truncated this
string to only the text i want .

Thanks in advance,
 Brad Cooper

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 17 Jun 2002 03:00:00 GMT  
 Passing fixed length string to API and is returning nulls in string
Hi Brad,

You can use the Left$ and InStr functions to stip off the nulls (represented
by constant vbNullChar):

    sResult = Left$(sAPIOutput, InStr(sAPIOutput, vbNullChar) - 1)

Regards,
Jake Marx

Quote:

> Hello all,
>   I'm passing a 250 byte fixed length string to a C API call.  After
> returning from the call, the string contains my text ....plus extra
> junk on the end of the string? are they nulls? how can I truncated this
> string to only the text i want .

> Thanks in advance,
>  Brad Cooper

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Mon, 17 Jun 2002 03:00:00 GMT  
 Passing fixed length string to API and is returning nulls in string
often the api will tell you the length of the string, if not you can just
use the instr function to search for the first chr$(0), then use Left$ to
trim the string.

--
Bill McCarthy, MVP VB
Total Environment
www.TotalEnviro.com/PlatformVB

Quote:

> Hello all,
>   I'm passing a 250 byte fixed length string to a C API call.  After
> returning from the call, the string contains my text ....plus extra
> junk on the end of the string? are they nulls? how can I truncated this
> string to only the text i want .

> Thanks in advance,
>  Brad Cooper

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Tue, 18 Jun 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Passing an array of fixed length strings.

2. Passing arrays of fixed length strings.

3. Passing Array of UDT Fixed-Length Strings

4. ADOX: Extending a fixed length Jet string field length

5. Differences between NULL, Empty String, Null String?

6. ACC97: Fixed-length strings question

7. Fixed length string

8. fixed string length

9. fixed-length string in vb.net

10. Fixed length string

11. Array of Fixed Length Strings...

12. Fixed Length String

 

 
Powered by phpBB® Forum Software