www.delorie.com/djgpp/bugs/show.cgi | search |
This function will always work on the first call and will never work on immediate succesive tries. void read(){ char* instr; fstream fs; fs.open(filename,ios::in); while(!fs.eof()){ fs.get(instr,10); cout << "Data " << instr << endl; } fs.flush(); fs.close(); }
If the char* is a parameter it works fine every time. void read(char* instr){ fstream fs; fs.open(filename,ios::in); while(!fs.eof()){ fs.get(instr,10); cout << "Data " << instr << endl; } fs.flush(); fs.close(); }
webmaster | delorie software privacy |
Copyright © 2010 by DJ Delorie | Updated Jul 2010 |