-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileHandling.cpp
More file actions
31 lines (23 loc) · 806 Bytes
/
FileHandling.cpp
File metadata and controls
31 lines (23 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <fstream>
// using the include funvtionality to impor the python modules in tot eh code to BE ABLE TO MAKE THE FULL use of the functionality
using namespace std;
int main()
{
//Declaring a file pointer and creating a file
ofstream makefile("Aadhaar.txt");
//Writing to the created file
makefile << "This file belongs to aadhaar kolu and his roll number is 2020a1r0404\n";
//Declaring a string variable to copy the contents to
string my_text;
// Declaring a file pointer to read the contents
ifstream Myfile("Aadhaar.txt");
//using a loop to copy all the contents to the variable
while(getline(Myfile,my_text))
{
cout<<my_text;
}
//closing the decared file fuction
Myfile.close();
return 0;
}