[futurebasic] Zero terminated ASCII strings

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 1999 : Group Archive : Group : All Groups

From: Sylvain Guillemette <allmedia@...>
Date: Sun, 10 Jan 1999 15:57:11 -0500
Hi,

I need to convert a C string to a Pascal string,
modify it, and convert it back to C.

All i have is a handle to the C string

DIM CHndl&  'Its stored here

How do i convert it to a Pascal string ?


Please, don't laugh too hard, this is
what i came up with to convert from Pascal to C:

'---------------------------------------
'Pascal string to C string

DIM pascal$, c$

pascal$ = "Hello"

FOR x = 1 TO LEN(pascal$)
  POKE @c$ + x - 1, PEEK(@pascal$ + x)
NEXT x

POKE @c$ + (LEN(pascal$) + 1), ASC("0")

'---------------------------------------

Is it any good or is there a simpler way that
i don't know ?


Thanks,

Sylvain