Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Getline help

  1. Jun 2, 2008 #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!!!
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: Getline help
  1. Need C++ getline() Help (Replies: 17)

  2. FORTRAN Help (Replies: 1)

  3. Fortran Help (Replies: 2)

  4. DE0 help (Replies: 7)

Loading...