Code:
char *split_sentence( char *fStr, char *bStr )
{
while( isspace( *fStr ) ) fStr++;
while( *fStr != '\0' ) {
if( *fStr == ' ' ) {
fStr++;
break;
}
*bStr++ = *fStr++;
}
*bStr = '\0';
while( isspace( *fStr ) ) fStr++;
return fStr;
}
To Use:
Code:
char Command[128];
Buffer = split_sentence( Buffer, Command );
if u need to split CStrings, one other way not mentioned yet would be to use the c_str() function.
Code:
char * Buffer = new char[ txtLastCommand->Text.Length() + 1 ];
strcpy( Buffer, txtLastCommand->Text.c_str() );
Buffer = split_sentence( Buffer, Command );
Hope it helps.