Printf/printing to files

So, I am trying to learn about how to save, open, close, write to, and append/add to files. I believe that this can be done by using printf, but I'm not sure. I don't think this is the correct syntax but I think printf looks something like this:

1
2
3
4
5
//...
{
printf(filename.append("Text!"))
}
//...
(Previously written text...)

Text!


So, I'd like to know how to do all of the things listed above (save, open, close, write to, and add/append to files), with the correct syntax, and maybe an example of it being used.

Thanks for your help!
Topic archived. No new replies allowed.