home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / GRAPHICS / MISC / PCXPIC10.ZIP / PCX2BAS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-07  |  1.3 KB  |  75 lines

  1. /*
  2.  * PCX2BAS -- Convert a .PCX image to BASIC BLOAD format
  3.  *
  4.  * Usage:     pcx2bas <infile> [outfile]
  5.  *
  6.  * Where:     <infile>  = .PCX file to translate.  .PCX extension by default.
  7.  *            [outfile] = BLOAD image to load (.PIC extension default)
  8.  *                        input filename is used, with .PCX added.
  9.  */
  10.  
  11. /* INCLUDES */
  12.  
  13. #include <stdio.h>
  14. #include <dir.h>
  15. #include <process.h>
  16. #include <conio.h>
  17.  
  18. #include "cga.h"
  19.  
  20.  
  21.  
  22.  
  23. /* DEFINES */
  24.  
  25. #define ERROR -1
  26.  
  27.  
  28.  
  29.  
  30. /* MAIN */
  31.  
  32. void main(int argc, char *argv[])
  33. {
  34.  char drive[MAXDRIVE], dir[MAXDIR], file[MAXFILE], ext[MAXEXT];
  35.  char infile[13], outfile[13];
  36.  
  37.  
  38.  if(argc == 1)
  39.   {
  40.   printf("Usage:  pcx2bas <infile> [WAIT]\n\n");
  41.   printf("Where:  <infile>  = .PCX image to load (.PCX extension default)\n");
  42.   exit(0);
  43.   }
  44.  
  45.  init_cga(0x04);            /* Initialize CGA mode 4 */
  46.  fnsplit(argv[1], drive, dir, file, ext);
  47.  
  48.  if(ext[0] == '\0')
  49.   fnmerge(infile, "", "", file, ".PCX");
  50.  else
  51.   fnmerge(infile, "", "", file, ext   );
  52.  
  53.  fnmerge(outfile, "", "", file, ".PIC");
  54.  
  55.  if(fload_pcx(infile) != ERROR)
  56.   {
  57.   save_pic(outfile);
  58.  
  59.   cls();
  60.  
  61.   fload_pic(outfile);
  62.  
  63.   if(argc == 3)
  64.    {
  65.    putch(7);  
  66.  
  67.    getch();
  68.    }
  69.   }
  70.  else
  71.   printf("Error...");
  72.  
  73.  mode(3);
  74. }
  75.