Perspective, thanks for your advice, it helped a lot.
I'm trying to do a preorder traversal on my tree and write a bool value and the node text into the file in the order of the traversal. It doesn't work (it creates a file with a single line containing the data for the root). I'm clueless because it works when I'm writing on the console. The only difference is that I'm writing into a different stream. Or is it?
Include this in the file I posted above:
Code:
void PreorderOutput(NodePtr ANode)
{
ofstream out_stream;
out_stream.open("data.txt");
out_stream << ANode->IsAnswer << ANode->Text << "\n";
cout << ANode->IsAnswer << ANode->Text << "\n";
if (!ANode->IsAnswer)
{
PreorderOutput(ANode->YesPtr);
PreorderOutput(ANode->NoPtr);
}
out_stream.close();
}