How to write to files ?

This is a discussion on How to write to files ? within the C++ Programming forums, part of the General Programming Boards category; I wrote a really cool program that prints the calendar
of any given year on the screen.. (using printf() )
...

name is a character string contains the name of the file(or the one you are creating), mode can be read"r" "a" for append, or "w" write, whihc I'll assume is what you want as you want ot write to a file.

the website below gives a really good example of writing and reading from files, in C:

after declare a file pointer, associating a file witht the pointer, and declaring mode to open file in, you write to file using the fprintf() function. Basically, any data written to screen with printf() can be written to file with fprintf().

how is writing to a file a useless option? You are talking about DOS redirection of standard output with the program > outputfile. So what you are suggesting is that no program should ever write to a file outside of DOS redirection? I hope you are joking.