|Ok, so here' the thing.|
I have to input a large amount of data; let's say a checkerboard with pieces on it, into the istream. (Cut and paste, not read from file)
So I input something like this:
- x - x - x - x - x
x - x - x - x- x -
- - - - - - - -
- o - o - o - o - o
o - o - o - o - o
Something like that. (I'm not actually doing checkers but I don't wanna give too much details, then it'd be too easy)
I want to input that data and then be able to read it and use it.
I have a gameboard initialized with a 2 dimensional array: board <-- ignore the numbers, I'm not actually doing checkers.
And when I print that, it looks fine.
Now I want to input the above mentioned data, and then start working right away.
So I tried this:
int StringToNumber (char blah)
//stringstream convert(blah); not sure where I was going with this
//return convert >> result ? result : 0;
void read_input(int board)
cout << "Your move?" << endl;
for(x=0; x<49; x++) //I'm not really doing checkers, but it is a 7x7 with ' ', '.' , 'S', and 'F' chars
cin.get(blah,1); //trying to read each char individual, and send it to the above function.
cout << blah; //seeing what it did.
int result = StringToNumber(blah,1);
//cout << result;
Basically, it's saying its an invalid conversion from 'char' to 'char*'.
Am I headed in the right direction here, and if so -- how can I make this comparison?
Ive also tried memset and memcmp as well as strcmp. Those aren't working for me either.