reactos/freeldr/bootsect/split.c
Brian Palmer 17dc9b5270 Full memory management support (memory.c & memory.h & mem.S)
Preliminary debug code (debug.c & debug.h)
Reworked .ini file code (parseini.c & parseini.h)
Size optimizations (fat.asm & fat32.asm)
FAT12/16 boot sector now fully understands the FAT (fat.asm)

svn path=/trunk/; revision=2049
2001-07-06 22:05:05 +00:00

55 lines
No EOL
807 B
C

#include <stdio.h>
FILE *in;
FILE *out;
FILE *new;
int main(int argc, char *argv[])
{
unsigned char ch;
int cnt;
int split_offset;
if (argc < 5)
{
printf("usage: split infile.bin outfile.bin newfile.bin split_offset\n");
return -1;
}
if ((in = fopen(argv[1], "rb")) == NULL)
{
printf("Couldn't open data file.\n");
return -1;
}
if ((out = fopen(argv[2], "wb")) == NULL)
{
printf("Couldn't open output file.\n");
return -1;
}
if ((new = fopen(argv[3], "wb")) == NULL)
{
printf("Couldn't open new file.\n");
return -1;
}
split_offset = atoi(argv[4]);
for (cnt=0; cnt<split_offset; cnt++)
{
ch = fgetc(in);
fputc(ch, out);
}
ch = fgetc(in);
while (!feof(in))
{
fputc(ch, new);
ch = fgetc(in);
}
fclose(in);
fclose(out);
fclose(new);
return 0;
}