Posted by dxprog on 06:32:00 10-02-2003
This is really frustrating me. I can't seem to find anything that would be the C equivalent of VB's Mid\InStr\Left\etc. functions. I've tried the std:string function, but it doesn't want to compile. Somebody PLEASE help!!!
[addsig]
Posted by cowsarenotevil on 06:48:00 10-02-2003
Sadly, I'm not as proficient in VB string manipulation as you, so I have no clue what those functions do, so I'd have a hard time finding C equivalents...
Posted by dxprog on 07:01:00 10-02-2003
PHP equivs:
Mid: substr
Left and Right are variants on Mid (one gets characters from the left side of a string the other fromt thr right)
[addsig]
Posted by paraffin on 16:37:00 10-09-2003
strncpy is your best bet for standard C strings. The equivalent for Mid (x, y) using strncpy would look like this in C:
Code:strncpy (dest, src + x - 1, y);
dest[y] = 0;
Manually appending a null character is necessary, since strncpy doesn't do it unless it copies the null character from the source string.
[ This Message was edited by: paraffin on 2003-10-09 16:39 ]
[ This Message was edited by: paraffin on 2003-10-09 16:39 ]