[RESOLVED] finding the offset in a char array
i have an array of char that looks like this:
"This_is_my_example_string"
im splitting the string on every "_" character , but also i want to find the position After the last "_" character and store it on an integer variable
how can i do that?
Code:
Splits = strtok( cBuffer, "_" );
while( Splits != NULL )
{
Splits = strtok( NULL, "_" );
}
Re: finding the offset in a char array
If the return value of strtok() is not NULL, then subtract the return value of strtok from the address of the buffer you're searching.
Edit:
Sorry, that should be subtract the starting address of the buffer from the return value of strtok.
Regards,
Paul McKenzie
Re: finding the offset in a char array
Re: finding the offset in a char array
Quote:
Originally Posted by
Cpp_Noob
thanks for the idea :)
Before doing anything, see the edit to my post.
Regards,
Paul McKenzie