Writing to a file help please

Hi, I have a function that opens a file and writes to that file

Void writeToFile() {

}

I have other functions that when those functions r called, I would like the cin and cout commands written to the file. So i was wondering how to do this. Calling those functions inside the writeToFile function I'm assuming won't work. Do I have to write those functions im calling inside the writeToFile function? Thank you.

Calling those functions inside the writeToFile function I'm assuming won't work.


That works perfectly fine. It depends, is it very long? are there many many many lines of code? if not, then just write it in the function you showed us, otherwise. If you have seperate functions for everything , yes you can just call them from writeToFile.
Last edited on
Anything?(code)

Aceix.

Hi Nevadarain,

Here is something that may help you. Please keep in mind, some to most of this may be over your head. That's fine, read through whatever it is you are working on anyway, if nothing else to pick up the terminology. You are still encouraged to ask questions, I am a novice c++ as well. Trust me, though I don't understand all of this, it helps.

http://www.bluefern.canterbury.ac.nz/ucsc%20userdocs/forucscwebsite/c/aix/standlib.pdf
thanks @tarikNeaj @aceix and @pearlyman
Last edited on
check rdbuf();

Aceix.
Topic archived. No new replies allowed.