I'll try a static variable. I'm not sure if it will go over too well. I have to declare it in the object class and not in main though.
Wiiire: I tried using flush and it did the same thing as you quoted.
Here's to be more specific:
Code:
ofstream csis;
int main(){
csis.open("csis.dat");
Do Stuff...
cout << stuff; //outputs stuff to the terminal window
csis << stuff; //writes the same stuff to the file
Object fun;
fun.dosomething(x,y);
cout << stuff;
csis << stuff;
fun.print(); //this is where the problem comes in
cout << stuff;
csis << stuff;
.
.
.
// This patter repeats itself about 20 times.
csis.close()
}
The end result would look like this in the file:
Code:
1 stuff
2 stuff
3 stuff
4 stuff
.
.
.
19 stuff
20 stuff
17 print //output from the print function (first appearance)
18 print
19 print
20 print