Getline help

  • #1
Here is the problem, I made up this program and compiled it with the Big CC compiler and it worked perfect, just the way I wanted it to work, however I have to switch compilers and get it to work on an xlC compiler which I am not familiar with, and of course the program compiles but does not work how it was suppose to work.

The part that is an error, is where I need to 'copy and paste' a infile. I need control of certain elements of the infile so i can do manipulation on them and run a model program, however I still need the rest of the infile for calculation purposes as well, so my thought was just create an outfile, store what I need control of and outfile it, and then outfile the rest of the infile. Then i can make changes to certain elements and sent it through a loop so I would have multiple runs with the data changing only slighly.

However, what happens now is that I gets through the first run fine, then it fails at the 2nd run b/c it did not copy the infile properly and i get this error

1525-001 The READ statement on the file ram.in cannot be completed because the end of the file was reached. The program will stop.

here is the piece of my code acting up
do{

inFile.open("ram1.in");
outFile.open("ram.in");
outFile <<fixed << showpoint << setprecision(1);

getline(inFile,line);
outFile<<line<<endl;
inFile>>junk >>zs >> zr;
outFile<<inFrequency<<" " << zs <<" " << zr;
while(getline(inFile,line))
{
outFile<<line<<'\n';
}
inFile.close();
outFile.close();


Please help!!!
 

Answers and Replies

Related Threads on Getline help

  • Last Post
Replies
17
Views
10K
Replies
9
Views
20K
  • Last Post
3
Replies
65
Views
859
Top