Give me some main concept of file handling | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Give me some main concept of file handling

8th Jun 2017, 11:06 PM
shayan akhtar
2 Answers
0
Here I write a commented example about reading files. Maybe this will help you, I would not know how to explain the concept. ********************************************** /include header files #include <fstream> #include <iostream> using namespace std; //main method declaration int main () {    char data[1000];     // open a file in read mode.    ifstream infile;    infile.open("file.txt");    cout << "Reading content from the file" << endl;    infile >> data;    // write the data    cout << data << endl;    //read the data from the file and display it.    infile >> data;    cout << data << endl;    // close the opened file.    infile.close();    return 0; **********************************************
10th Jun 2017, 3:48 AM
Joel Buenrostro
Joel Buenrostro - avatar
0
tnx
10th Jun 2017, 8:08 AM
shayan akhtar