== tar&untar ==
~cpp #include <io.h> #include <stdio.h> void main() { // tar FILE * to= fopen("tar.dat", "wb"); FILE * from; const int MAX_BUF= 1024; char buffer[MAX_BUF]; _finddata_t file; int handle= _findfirst("tar\*", &file); while( _findnext(handle, &file)==0 ){ if (!(file.attrib & _A_SUBDIR )){ fwrite( &file, sizeof(_finddata_t), 1, to); sprintf(buffer, "tar\%s", file.name); from= fopen(buffer, "rb"); for ( unsigned int i= 0 ; i < file.size ; i++ ) fputc(fgetc(from), to); fclose(from); } } fclose(to); // untar from= fopen("tar.dat", "rb"); while( fread(&file, sizeof(_finddata_t), 1, from) ){ sprintf(buffer, "untar\%s", file.name); to= fopen(buffer, "wb"); for( unsigned int i= 0 ; i < file.size ; i++ ) fputc(fgetc(from), to); fclose(to); } fclose(to); }