Monday, July 27, 2009

C++, Char String Read In Problem?

while(fin) {


for(i=0;i%26lt;=11;i++)


{


fin%26gt;%26gt;schools[posit][posit2];


}





It keeps reading in after the whitespaces. I have ints after the whitespace so it reads in


EastSide1555





(fin is what I set ifstream to)

C++, Char String Read In Problem?
Unless you do something special, each call will read in a white-space separated token. And since schools[][] doesn't have any changes to indices, each read (all 12 of them) will write into the same location.





If you are trying to read a character at a time, check out the get() functions for stream.

email cards

No comments:

Post a Comment