006
24.04.2003, 12:56 Uhr
virtual
Sexiest Bit alive (Operator)
|
Die mit abstand portableste Lösung dürfte sowas in der Art sein:
C++: |
int CopyFile( const char* src_name, const char* dst_name) { FILE* src; FILE* dst; char buffer[4096]; int len; int ret = 0;
if (NULL == (src = fopen(scr_name, "rb"))) return -1; if (NULL == (dst = fopen(dst_name, "wb"))) { fclose(src); return -1; } do { len = fread(buffer, 1, sizeof(buffer), src); if (len>0) { if (len != fwrite(buffer, 1, len, dst)) { break; } } } while (len == sizeof(buffer));
ret = feof(src) && !ferror(dst)? 0:-1; fclose(src); fclose(dst); return ret; }
|
Oder so ähnlich. Obiges ist ungetestet! -- Gruß, virtual Quote of the Month Ich eß' nur was ein Gesicht hat (Creme 21) |