When writing to file, it keeps writing on the same line

Hi guys. Im trying to write to a file here. All the calculations are correct but it keeps writing to the same line. I know im probably missing something elementary.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  for(coloumns=0; p>=3600; coloumns++)
    {
        i++;

        ofstream outFile;
        outFile.open("byhour.txt");
         if(outFile.fail())
    {
        cerr << "Error, the file cannot be opened." << endl;
        exit(1);
    }
        outFile << i << " " << accumulatedPower/3600000 << endl;

        accumulatedPower=0;
        p=0;
    }

.
Last edited on
Topic archived. No new replies allowed.