#include #include #include int split(const char *filename, const char *tdrive, const char *tdir, const char *tname, size_t blocksize) { void *buffer = malloc(blocksize); if(buffer==NULL) { fprintf(stderr, "Could not allocate room for buffer (%d bytes)\n",blocksize); return 2; } FILE *ifp=fopen(filename,"rb"); if(ifp==NULL) { perror("Could not open input file"); return 3; } int count=0; for(;;) { char templatename[_MAX_PATH]; char ext[_MAX_EXT]; sprintf(ext,".%03d",count++); _makepath(templatename,tdrive,tdir,tname,ext); FILE *ofp=fopen(templatename,"wb"); if(ofp==NULL) { perror("Could not create output file"); return 4; } size_t bytesRead = fread(buffer,1,blocksize,ifp); size_t bytesWritten = fwrite(buffer,1,bytesRead,ofp); if(bytesWritten