Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Read txt data from directory I want using ifstream?

Status
Not open for further replies.

H3RO

Programmer
Jan 8, 2003
12
LT
Hi all. I'm having a little probleme reading txt information. Could someone please help me? I want for ifstream to read information from example C:\Test.txt and save it to directory D:\OkTest.txt ? Pleaaase help, this is the source I am using, correct it to the way it should be.

#include<string>
#include<fstream>
using namespace std;

void main(){
ifstream read(&quot;Test.txt&quot;);
ofstream write(&quot;OkTest.txt&quot;);
string s;
while (getline(read,s))
write<<s<<endl;
}

Thanks (^.^)>;;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top