Writing to single file in multiple functions
Hi all from a beginner,
I'm trying to print all my output from a program to a single text file (running in unix) (I tried the redirection ">" but didn't work)
I opened the file in main(), and written some output to it using fprintf(), then I called a function, opened the file again with
fopen("output.txt","a")
and tried to use fprintf again to append output to the same file, but when I run the program, only the output from main() were printed to the file, nothing was printed after the call to the second function.
How do I do this?
Cheers. :)