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.




{ 1 comment… read it below or add one }
Tahnx i dont Want your making money online class(i have already subscribed it Can you sent me) C++ lessons