home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!corton!enst!ulysse!meduse!jeannet
- From: jeannet@meduse.enst.fr (Olivier Jeannet)
- Newsgroups: comp.sys.amiga.misc
- Subject: Re: Splitting and joining large files like gcc2.2.2
- Message-ID: <2508@ulysse.enst.fr>
- Date: 3 Sep 92 15:07:51 GMT
- References: <26AUG199218353578@vx9000.weber.edu>
- Sender: news@ulysse.enst.fr
- Organization: Telecom Paris, France
- Lines: 77
-
- In article <26AUG199218353578@vx9000.weber.edu>, alewis@vx9000.weber.edu (ALEWIS) writes:
- > I'm sure there's an easy way to do this, but I can't figure it out.
- >
- > I'm trying to get the latest gcc which comes in a 3M+ file. I don't have the
- > modem option so I was hoping to find a join for the Amiga that would work with
- > files split on a SUN, NeXT, or DOS machine. I am unable to compile my own
- > versions on the source machines, so the source files at wuarchive won't help.
- >
- > Any suggestions?
-
- I wrote the following program to split a file in 2 or more files.
- You use it like that:
- "split gcc2.2.2.lha gcc_part"
- and you will get the following files : gcc_part1, gcc_part2, etc..
- I use this program to copy the files to MS-DOS 720K disks and when I copy the
- files back to an amiga, I just have to
- "join gcc_part1 gcc_part2 [..] as gcc2.2.2.lha"
-
- My program is badly written but it works.
-
- ------ beginning of split.c ------
-
- #include <stdio.h>
-
- #define FLOPPYSIZE (1425*512)
- /* a 720K MS-DOS can hold a maximum of 729600 bytes */
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
-
- FILE *in,*out;
- char filename[120],ext[2];
- int c;
-
- long int count=0;
- int filenum=1;
-
- if (argc != 3) {
- fputs("usage: split source destination\n",stderr);
- exit(0);
- }
-
- if (!(in=fopen(argv[1],"rb"))) {
- fprintf(stderr,"unable to open '%s'",argv[1]);
- exit(0);
- }
-
- strcpy(filename,argv[2]);
- ext[0]=(char)filenum+48; ext[1]='\0'; /* 48 = ASCII value of '0' */
- strcat(filename,ext);
-
- if (!(out=fopen(filename,"wb"))) {
- fprintf(stderr,"unable to open '%s'",filename);
- exit(0);
- }
-
- while ((c=getc(in)) != EOF) {
- putc(c,out);
- ++count;
- if (!(count % FLOPPYSIZE)) {
- fclose(out);
- ++filenum;
- strcpy(filename,argv[2]);
- ext[0]=(char)filenum+48; ext[1]='\0';
- strcat(filename,ext);
- if (!(out=fopen(filename,"wb"))) {
- fprintf(stderr,"unable to open '%s'",filename);
- exit(0);
- }
- }
- }
-
- } /* end of main() */
-
- ------ end of split.c ------
-