In C, how do I extract the first n characters from a string until I find a space in the string? Essentially, which C function will find the position of the next space for me and which C function will give me a substring? I am thinking in terms of C++. such as:
string str = "Help me Please!";
int blankPos = str.find(' ');
str.substr(0, blankPos);
Thanks,
strchr
to find the space.char
buffer to hold the substring.memcpy
.