Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

from vb to c++

this is how i used to do it in vb.. e..g..

Dim Data As String, Output As String
'this can be any length, but this part is always static - GKSSP\0\0\0\0\0\0\0\0
Data = "GKSSP\0\0\0\0\0\0\0\0*?+?"

'trying to parse it to get the ascii bit - *?+?
Output = Mid(Data, InStr(Replace(Replace(Data, Chr(2), "?"), Chr(3), "?"), "?\0\0\0?\0\0\0") + 14)

any ideas guys how i can change that to c++ code?

if i feed something like this into a c++ function as a paramteter..

GKSSP\0\0\0\0\0\0\0\0*?+?

i have to replace the \ with a \\ right? (so c++ know its a backslah)

and also replace \2 with ?, \3 with ? (as it is in the vb)

im trying to parse it to get the ascii data on the end of the string, but i dont know if c++ has built in functions like mid, replace, instr etc

please help guys
[883 byte] By [pouncer] at [2007-11-11 7:48:34]
# 1 Re: from vb to c++
C++ does and doesn't. That is, you need to use std::string to use functions such as repalce. You can also use the C <string.h> library functions such as strcat, strcmp, strstsr etc. but they are quite dangerous and work only only on char buffers.
You cna read more about std::string operations here:
http://www.dev-archive.com/getHelpOn/10MinuteSolution/16972
Danny at 2007-11-11 21:01:55 >