Write and read files problem

I new to this so any help is welcomed :) I want to find text document and everything what's in it to be printed on the screen
yap, i solved something like this... but my idea was to enter the name of the file and then it prints on the screen everything what is in the text document :)
You can read input in a string, and then pass it ( using c_str ) to the fstream constructor or open method

1
2
3
string s;
// read s
fstream myfile ( s.c_str() );
Last edited on
i want to do something like this press 1 to read form a file (this will be solved with switch)
and then cout<<"enter the file name..." and the prints on the screen... and I still don't know how to solve the problem :)
You won't get more help than this unless you show your efforts
Topic archived. No new replies allowed.