copying a file, ifstream+ofstream?
I decided I wanted to learn some file i/o and started by copying a file...specifically an image png file.. which ended up working but am wondering if this is the best/correct way to be doing this and if I could possibly run into problems ?
I used this code for a simple 2 liner of text file and it worked, then to my surprise it worked on an image without complain though.
is there a more clever way than this, that i am not seeing?
and as well, I read that theres a close method.. are file automatically closed anyway? I mean my file was created .. it must have been closed by itself anyway.
void copy_file(string srcf , const char *destf)
dest << words << endl;