In turbo c++,how can i copy a certain file from one drive to the other e.g,the file is located in G:\one ,i want to copy it to C:\tc the file name is "file.txt"...Much love

Don't know about Turbo C++. This is standard C++; it may work in Turbo C++ too.

// open the source file for input (text)
std::ifstream srce_file( "G:/one/file.txt" ) ; 
// or "G:\\one\\file.txt" if it is a really old version of Windows
// check for is_open() elided for brevity

// open the destination file for output (text), 
// truncate if it exists, create new otherwise
std::ofstream dest_file( "C:/tc/file.txt" ) ; 

// copy file
dest_file << srce_file.rdbuf() ;

As an aside, when C++17 turns up, the filesystem library will allow something like this:

copy_file(source_path,destination_path);

Currently, you can make use of it through Boost.

The File System TS was published a couple of days back.
http://www.iso.org/iso/catalogue_detail.htm?csnumber=63483

Final Draft: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf

It is just a TS, so: 'This Technical Specification is applicable only to vendors who wish to provide the interface it describes.'

'Starting in 2012, the committee has transitioned to a "decoupled" model where major pieces of work can progress independently from the Standard itself and be delivered as separate TS's. Vendors can choose to implement these, and the community can gain experience with the std::experimental version of each feature.' - https://isocpp.org/std/status

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.