I was writing a program when I ran into a problem. I was trying to use wstringstream to get data from wstring. All went fine until few last variables didn't get correct values, in fact they didn't get anything from the stream. I wrote a small application to show what happens: http://pastie.org/2799401
Image showing that values aren't correct: http://img683.imageshack.us/img683/4817/streamproblem.png
I just realized the problem is actually in reading the file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
int npccount;
savefile >> npccount;
int junk;
/// I need to get to next line here, it seems that I did it by reading first value from that line ////
savefile >> junk;
// QuickMessage(hWnd,junk); /// confirms that it read the first 100
if (npccount > 0){
for (int i=0; i < npccount; i++){
char filecont[400];
string fromfile="";
savefile.getline(filecont,400);
fromfile=filecont;
// QuickMessage(hWnd,fromfile);
int empt=npc::GetEmptySlot();
npcarray[empt]=npc(fromfile);
}
}
How do I get to next line without taking anything from it, or should I just make it so that it is written to end of previous line- will though cause problems later?