String Token C++ nooby

Trying to concat a string and get the first word out of it. I am from JAVA background but now trying to learn c++. Here is what I have written so far. Of course it doesn't work since you can't add chars like that lol. In java you can just substring and it takes out everything before it. Is there a way to do that in c.


#include <iostream>
#include <stdio.h>

using namespace std;
int main()
{

int someValue = 14;
int pointer = 0;
char firstWord[] = "";
char something[] = "This is$a.string";
for ( int i = 0; i < someValue; i++ )
{
cout << "This is a step through " << endl;
cout << something[i] << endl;
if (something[i] == ' ' )
{
int p = 0;
char buffer[] = "";
while( p <= i )
{
buffer[] += something[p];
p++;
}
firstWord[] = bufferp[];
}
}


}
Topic archived. No new replies allowed.