Partial File Output?

I'm having some issues with the following code on a program assignment:

1
2
3
const void expression::showInfix(ostream& cout) {
  cout << "Infix:   " << ifix << endl;
}


Now, before you think I'm completely off my rocker, my instructor posted the UML of this method as:

 
+showInfix(ostream&=cout) const: void


And specifies that the program is to read data from a file, and write the results to a second file. So..I have declared ofstream fout; and passed fout to showInfix:

 
myExpression.showInfix(fout);


While the program is running, I am getting output in the console, as well as in the file that is supposed to be written to. However, the data being written to the file is:

1
2
3
4
5
6
7
Infix:
Postfix:

Infix
Postfix:

...


Anyone know why the remainder of my data (in this case, ifix) isn't making it to the file?
What information holds the "ifix"? If it doesn't have much, then your output it's just... natural!
ifix is a member variable of the myExpression object's class. The problem was that I was clearing ifix before trying to output it (recycling the same instance) due to the way the program was written. This led to it being an empty variable. I changed two lines of code, and it works...and I've been fighting with it for the past 16 hours trying to figure out what the deal was...
Topic archived. No new replies allowed.