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 Post1) Do not bump threads
2) Give enough information for us to understand the problem
3) Read the Member Rules
Jump to PostTo just copy a file:
#include <fstream> bool copy_file( const char* infile, const char* outfile ) { std::ifstream fin( infile ) ; std::ofstream fout( outfile ) ; return fout << fin.rdbuf() ; }
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.