home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / MISC / MAKECOM.ZIP / MAKECOM.C next >
Encoding:
C/C++ Source or Header  |  1991-06-26  |  1.9 KB  |  70 lines

  1. /*
  2.     Makes a .COM file that automatically pops text on the screen
  3.     from a .TXT file
  4. */
  5. #include <stdio.h>
  6. #include <string.h>
  7.  
  8. int binary_data[] =
  9.     {
  10.     0xEB, 0x08, 0x00, 0x00, 0x0D, 0x53, 0x01, 0x41, 0x04,
  11.     0x1A, 0x33, 0xC0, 0x8E, 0xC0, 0x26, 0xA1, 0x63, 0x04,
  12.     0x05, 0x06, 0x00, 0xA3, 0x02, 0x01, 0xB8, 0x00, 0x0F,
  13.     0xCD, 0x10, 0x80, 0xFC, 0x50, 0x75, 0x5A, 0x53, 0x3C,
  14.     0x03, 0x76, 0x0E, 0x3C, 0x07, 0x75, 0x51, 0xB8, 0x00,
  15.     0xB0, 0xC6, 0x06, 0x06, 0x01, 0x00, 0xEB, 0x0A, 0xB8,
  16.     0x00, 0x01, 0x86, 0xFB, 0xF7, 0xE3, 0x05, 0x00, 0xB8,
  17.     0x8E, 0xC0, 0xB4, 0x08, 0x30, 0xFF, 0xCD, 0x10, 0x88,
  18.     0xE7, 0xB8, 0x00, 0x06, 0x31, 0xC9, 0xBA, 0x4F, 0x18,
  19.     0xCD, 0x10, 0xB9, 0x80, 0x07, 0x31, 0xFF, 0xBE, 0x80,
  20.     0x01, 0x80, 0x3E, 0x06, 0x01, 0x00, 0x74, 0x0E, 0x8B,
  21.     0x16, 0x02, 0x01, 0xED, 0xD0, 0xE8, 0x72, 0xFB, 0xED,
  22.     0xD0, 0xE8, 0x73, 0xFB, 0xAC, 0xAA, 0x47, 0xE2, 0xE6,
  23.     0xB8, 0x00, 0x02, 0xBA, 0x00, 0x17, 0x5B, 0xCD, 0x10,
  24.     0xCD, 0x20
  25.     };
  26.  
  27. #define BINARY sizeof (binary_data) / sizeof (binary_data[0])
  28.  
  29.  
  30. int main (int argc, char *argv[])
  31.     {
  32.     FILE    *infile, *outfile;
  33.     int     i, lines;
  34.     char    buffer[80], *ptr;
  35.  
  36.     if (argc != 3)
  37.         {
  38.         puts ("You must specify the input and output files on the command line.");
  39.         return (1);
  40.         }
  41.     infile = fopen (argv[1], "r");
  42.     if (infile == NULL)
  43.         {
  44.         puts ("Error opening input file.");
  45.         return (2);
  46.         }
  47.     outfile = fopen (argv[2], "wb");
  48.     if (outfile == NULL)
  49.         {
  50.         puts ("Error opening output file.");
  51.         fclose  (infile);
  52.         return (3);
  53.         }
  54.     for (i = 0; i < BINARY; i++) fputc (binary_data[i], outfile);
  55.     lines = 0;
  56.     while (lines < 24)
  57.         {
  58.         memset (buffer, ' ', 80);
  59.         if (!feof (infile))
  60.             fgets (buffer, 80, infile);
  61.         ptr = memchr (buffer, '\n', 80);
  62.         if (ptr != NULL) *ptr = ' ';
  63.         for (i = 0; i < 80; i++) fputc (buffer[i], outfile);
  64.         lines++;
  65.         }
  66.     fclose (infile);
  67.     fclose (outfile);
  68.     return (0);
  69.     }
  70.