In the previous tutorial we explained how to do that in C#, now we will do that in C++.
So, create a Win32 C++ Console Application. This tutorial will be similar to the tutorial for writing to file in c++,
So, write this code
int main() { ifstream in; in.open("text.txt"); char line[256]; while(in.getline(line, 256)) cout << line << endl; in.close(); }
Here we read the file line by line, and write its content to the console.
We have one char variable where we will store that lines, it will be long 256 characters. We are using the ifstream class, and creating an object from it, opening the file, do our work, and in the end we are closing the handle from our application to the file we read.
That's it. Very simple.
- Write To File In C++
- Read From File Using StreamReader Class
- Write To File in C#
- ASP at a glance
- Using the Timer Class
Enter your Name and Email below to subscribe and start 1 month free course now.








