c programming

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...
 
Back
Top