Archived

This topic is now archived and is closed to further replies.

omegasyphon

problem with reading in a file

Recommended Posts

omegasyphon    100
ok i have a file defined as so 00 00 00 01 02 01 01 01 01 now i open the file the following way ifstream fin("data.dat"); ofstream fout("data1.txt");
        
while (!fin.eof())
{
     fin<<a;
     fout>>a;
}
fin.close();
fout.close();
        
now when i go to open my output file data.txt all i get is 1 zero in the top left corner and i dont know why? also im using msvc5++ on win98 Edited by - omegasyphon on 7/20/00 2:48:58 PM

Share this post


Link to post
Share on other sites
BriarLoDeran    122
What are you trying to do? Do you want to fill data1.txt with what's in data.dat? If so, then you shouldn't be using cin or cout. You should be doing:

    
fin << a;
fout >> a;


-> Briar LoDeran <-

Edited by - BriarLoDeran on July 20, 2000 3:30:44 PM

Share this post


Link to post
Share on other sites
omegasyphon    100
well i forgot to say that im trying to read in the data.dat file and load it into an array of 3x3 but right now im just doing testing to get my algorithm working to read it into an array and display it in my data.txt file to see if it works

Share this post


Link to post
Share on other sites