It depends on what file you want to open... kind of. For the most part I would say fopen.
fopen will open a named file and return a stream. If there is no named file, or another error occurs, it returns NULL. To be able to do things within a file, you should create a FILE*.
- Code: Select all
FILE * fopen(const char * filename, const char * mode);
The file name is the complete name of the file... The mode can be;
"r" opens text file for reading
"w" creates text file for writing, it will discard the previous contents
"a" I think this is apend, which if I am not mistaken opens or creates text file, but you start at the end of the file
"r+" I think this is just update reading, though there are more rules to this, so I don't suggest it.
"w+" Again for update, don't suggest.
"a+" Same as a but update...