S shashidhar Apprentice Mar 22, 2011 #1 in c or c++ whats the API to copy files from one location to another..... is there any?
H haraakiri Explorer Mar 22, 2011 #2 Generally you need to make use of platform specific APIs. I personally use portable boost.filesystem( c++ )
Generally you need to make use of platform specific APIs. I personally use portable boost.filesystem( c++ )
vishalrao Global Moral Police Luminary Mar 23, 2011 #3 Cross platform portable coding would be to use the standard "stdio.h" or <cstdio> include headers then use the following APIs to copy a file from source to target: pseudocode: Code: source = fopen(source_file_name, binary_mode); target = fopen(target_file_name, binary_mode); while ( (int bytes_read = fread(source, bytes)) > 0) { if ( (int bytes_written = fwrite(target, bytes)) <= 0) { return error_code; } } return success_code; Should work everywhere, windows, linux, mac, etc...
Cross platform portable coding would be to use the standard "stdio.h" or <cstdio> include headers then use the following APIs to copy a file from source to target: pseudocode: Code: source = fopen(source_file_name, binary_mode); target = fopen(target_file_name, binary_mode); while ( (int bytes_read = fread(source, bytes)) > 0) { if ( (int bytes_written = fwrite(target, bytes)) <= 0) { return error_code; } } return success_code; Should work everywhere, windows, linux, mac, etc...