Path: utzoo!attcan!uunet!lll-winken!tekbspa!optilink!cramer From: cramer@optilink.UUCP (Clayton Cramer) Newsgroups: comp.sys.ibm.pc Subject: Re: Copying very large files Message-ID: <2658@optilink.UUCP> Date: 24 Nov 89 19:13:39 GMT References: <1380@ucf-cs.UCF.EDU> Distribution: na Organization: Optilink Corporation, Petaluma, CA Lines: 80 In article <1380@ucf-cs.UCF.EDU>, wordproc@ucf-cs.UCF.EDU (wordproc) writes: > > I have a very large file on my MSDOS 4.01 machine that I need to copy onto > 360K diskettes and transfer onto an MSDOS 3.3 machine. > > The file is an .EXE file of about a megabyte in length and is a self-extracting > archive created with PAK. > > Naturally, I cannot use 4.01's BACKUP/RESTORE to copy the file over several > disks because 4.01's RESTORE will give an "incorrect DOS version" error when > I try to restore the file to the MSDOS 3.3 machine's hard disk. I presume > that using MSDOS 3.3's BACKUP/RESTORE will fail for the same or similar > reason. > > Marcus Clenney ___ ___ /___ ___/ ________ / Try this program. To reconstruct the files, use COPY file1+file2+file3 dest/B. ------ #include #include #include "std.h" main(Argc, Argv) int Argc; char* Argv[]; { long BytesThisPartFile; long BytesPerPart; int PartNbr; char OutFileName[40]; FILE* OutFile; FILE* FileToPart; char* Bytes; bool MoreBytes = TRUE; int BytesRead; FileToPart = fopen(Argv[1], "rb"); sscanf(Argv[3], "%ld", &BytesPerPart); BytesPerPart *= 1000L; Bytes = malloc(1000); if((Bytes) && (FileToPart)) { PartNbr = 0; sprintf(OutFileName, Argv[2], PartNbr); fprintf(stderr, "creating %s\n", OutFileName); BytesThisPartFile = 0L; OutFile = fopen(OutFileName, "wb"); if(OutFile) { while(MoreBytes) { BytesRead = fread(Bytes, sizeof(char), sizeof(Bytes), FileToPart); fwrite(Bytes, sizeof(char), BytesRead, OutFile); BytesThisPartFile += sizeof(Bytes); if(feof(FileToPart)) MoreBytes = FALSE; else if(BytesThisPartFile >= BytesPerPart) { PartNbr++; fclose(OutFile); sprintf(OutFileName, Argv[2], PartNbr); fprintf(stderr, "creating %s\n", OutFileName); BytesThisPartFile = 0L; OutFile = fopen(OutFileName, "wb"); } } } fclose(OutFile); } } ---- -- Clayton E. Cramer {pyramid,pixar,tekbspa}!optilink!cramer My definition of social justice: those who refuse to work deserve to go hungry. =============================================================================== Disclaimer? You must be kidding! No company would hold opinions like mine!