Cannot write to file.

Hi guys. The for loop runs 100% perfectly except its not writing the values to the file.(Yes I know its meant to be 'outfile' but im writing out to two different files so I thought that I might not be able to use the same object to write to two files. Would it make a difference?

Any help will be greatly appreaciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
       ofstream outHour;
     outHour.open("byhour.txt");

    for(coloumns=0; p>=3600; coloumns++)
    {
        i++;


        outHour << i << accumulatedPower/3600000 << endl;

        accumulatedPower=0;
        p=0;
    }
that loops seems to be an infinite one
no because p gets set back to zero. therefore everytime p reaches 3600 the loop runs. its just not writing to the file
can you post the whole code ? or at least the codes outside that loop
1
2
3
4
5
6
#include <iostream>
#include <vector>
#include <fstream>
#include <cstdlib>
#in
Last edited on
Topic archived. No new replies allowed.