Below is the simple c++ example program, to read contents from a text file stored in your computer's hard drive...
#include<iostream.h> #include<fstream.h> void main() { char *name; int num; ifstream filein; filein.open("d:\\cpp\\pgm\\a.txt"); filein>>name; filein>>num; cout<<name<<endl; cout<<num<<endl; filein.close(); }
Hope this helps..
Techytips
1 comments:
cplusplus samples to starters
c++ sample - Single linked list
Post a Comment