i got a .txt file that contain data,
and i would like to read from the file and then write the data to another file,
is it about ifstream and ofstream?..
what i have done is just open the input file and open the output file :((
how to relate two files together? i am a newbie in c++, hope someone can help..:(
tech9x
0
Light Poster
Recommended Answers
Jump to Posttry to read the input file into a char * temp or some other string and then in the output file try to write this temp.
Also, this is a fstream operation.
Jump to Postchar * temp is basically a string. if you open your file in fsteam as textFile, you can just do
textFile >> temp;
this will read your first sentence into the temp variable.
if you put this in loop and loop till textfile.eof() is true, you will …
All 8 Replies
sid78669
0
Junior Poster
tech9x
0
Light Poster
sid78669
0
Junior Poster
tech9x
0
Light Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
sid78669
0
Junior Poster
tech9x
0
Light Poster
vijayan121
1,152
Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.