You're opening the file each time
And you should only write the data, not the pointers as well
Code:
void Order(TreePointer Root, FILE *filePtr ) {
if ( Root == NULL ) return;
Order(Root->Left);
fprintf( filePtr, "%s\n", Root->Data );
// fwrite(Root->Data, sizeof(Root->Data),1,filePtr);
Order(Root->Right);
}
You open the file before you call this function, then close it after the function returns
If you want a binary file, use the fwrite
If you want a text file (as you seem to suggest), then use fprintf