that works, but why won't mine? It does the same thing. I don't want just the string before the space, I want both before and after(I haven't finished that part yet, its only supposed to get whats before it). There is no problem with getting them. The only problem is that the statement
Code:
if (Input[x] == ' ')
does not return true if Input[x] is a space. Perhaps seeing where it is used in my .cpp will be some help.
Code:
char cmd[256];
done = false;
while(!done == true)
{
cin >> cmd;
Input(cmd);
Code:
void Input(char Input[])
{
int x;
int iArg;
string sArg;
string sArg2;
sArg = "";
sArg2 = "";
char space;
space = 'h';
iArg = 0;
for(x = 0;x < strlen(Input);x++)
{
if(iArg == 0)
{
if (Input[x] == ' ')
{
iArg = 1;
}
else
{
sArg = sArg + Input[x];
}
}
if(iArg == 1)
{
sArg2 = sArg2 + Input[x];
}
}
cout << sArg << endl;
}
Though, somehow, it was working once before, but I changed it temporarily for other things.