Hi,
I've written a program and want the output to go to file. My data is stored in a linked-list and a function is called to loop through the list and print it, using something like
printf("%s\n", mylist->item1);
However, I now want the user to be able to print the results to file, specifiying the filename. So the user is prompted to input a filename, that file is created and the results are stored in that file.
Do I now have to use puts(), or is there a way that I can just open a new file and specify that all printf's are printed there?
NB:- I have tried using the redirection (>) operator but because my program is reading from one file and writing to another, this redirects the prompt for the input file to the output file, so the user is not asked for input.
Appreciating any help...
Bill