reading files in c++
REading files in c++
- Include the <fstream> library
- Create a stream (input, output, both)
- ofstream myfile; (for writing to a file)
- ifstream myfile; (for reading a file)
- fstream myfile; (for reading and writing a file)
- Open the file myfile.open(“filename”);
- Write or read the file
- Close the file myfile.close();
Comments
Post a Comment