home *** CD-ROM | disk | FTP | other *** search
- /*
- Makes a .COM file that automatically pops text on the screen
- from a .TXT file
- */
- #include <stdio.h>
- #include <string.h>
-
- int binary_data[] =
- {
- 0xEB, 0x08, 0x00, 0x00, 0x0D, 0x53, 0x01, 0x41, 0x04,
- 0x1A, 0x33, 0xC0, 0x8E, 0xC0, 0x26, 0xA1, 0x63, 0x04,
- 0x05, 0x06, 0x00, 0xA3, 0x02, 0x01, 0xB8, 0x00, 0x0F,
- 0xCD, 0x10, 0x80, 0xFC, 0x50, 0x75, 0x5A, 0x53, 0x3C,
- 0x03, 0x76, 0x0E, 0x3C, 0x07, 0x75, 0x51, 0xB8, 0x00,
- 0xB0, 0xC6, 0x06, 0x06, 0x01, 0x00, 0xEB, 0x0A, 0xB8,
- 0x00, 0x01, 0x86, 0xFB, 0xF7, 0xE3, 0x05, 0x00, 0xB8,
- 0x8E, 0xC0, 0xB4, 0x08, 0x30, 0xFF, 0xCD, 0x10, 0x88,
- 0xE7, 0xB8, 0x00, 0x06, 0x31, 0xC9, 0xBA, 0x4F, 0x18,
- 0xCD, 0x10, 0xB9, 0x80, 0x07, 0x31, 0xFF, 0xBE, 0x80,
- 0x01, 0x80, 0x3E, 0x06, 0x01, 0x00, 0x74, 0x0E, 0x8B,
- 0x16, 0x02, 0x01, 0xED, 0xD0, 0xE8, 0x72, 0xFB, 0xED,
- 0xD0, 0xE8, 0x73, 0xFB, 0xAC, 0xAA, 0x47, 0xE2, 0xE6,
- 0xB8, 0x00, 0x02, 0xBA, 0x00, 0x17, 0x5B, 0xCD, 0x10,
- 0xCD, 0x20
- };
-
- #define BINARY sizeof (binary_data) / sizeof (binary_data[0])
-
-
- int main (int argc, char *argv[])
- {
- FILE *infile, *outfile;
- int i, lines;
- char buffer[80], *ptr;
-
- if (argc != 3)
- {
- puts ("You must specify the input and output files on the command line.");
- return (1);
- }
- infile = fopen (argv[1], "r");
- if (infile == NULL)
- {
- puts ("Error opening input file.");
- return (2);
- }
- outfile = fopen (argv[2], "wb");
- if (outfile == NULL)
- {
- puts ("Error opening output file.");
- fclose (infile);
- return (3);
- }
- for (i = 0; i < BINARY; i++) fputc (binary_data[i], outfile);
- lines = 0;
- while (lines < 24)
- {
- memset (buffer, ' ', 80);
- if (!feof (infile))
- fgets (buffer, 80, infile);
- ptr = memchr (buffer, '\n', 80);
- if (ptr != NULL) *ptr = ' ';
- for (i = 0; i < 80; i++) fputc (buffer[i], outfile);
- lines++;
- }
- fclose (infile);
- fclose (outfile);
- return (0);
- }
-