+ 1

How to open a file in c++?

12th Dec 2016, 6:43 AM
abhishek
4 Answers
+ 4
#include <iostream> #include <fstream> using namespace std; int main () { ofstream myfile; myfile.open ("example.txt"); myfile << "Writing this to a file.\n"; myfile.close(); return 0; }
12th Dec 2016, 11:45 AM
Akwin Lopez
Akwin Lopez - avatar
+ 1
do you mean opening file to work with or open a photo,video etc.?
12th Dec 2016, 7:25 AM
Muhammetnur AmangeldiĂœew
+ 1
thnx akwin lopez
3rd Jan 2017, 12:17 PM
abhishek
0
simply download a c++ program viewer
13th Dec 2016, 7:14 PM
smartguy100
smartguy100 - avatar