home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / m / m071 / 1.img / CPP / SAMPLECP.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-20  |  1.4 KB  |  36 lines

  1. /*====================================================================*/
  2. /*     Sample program in C++ language to show files in CAP format.    */
  3. /*     By: Kuo Shiang Shiang (Djohan) & Jeng Shun Huo (Fire)          */
  4. /*                                                                    */
  5. /*     Compiler       :  Turbo/Borland C++ V1.0 or later              */
  6. /*     Model          :  Huge                                         */
  7. /*     Project file   :  SAMPLECP.PRJ                                 */
  8. /*     C Library used :  CAP.OBJ                                      */
  9. /*====================================================================*/
  10. #include <iostream.h>
  11. #include <conio.h>
  12.  
  13. extern "C" {int Show_CAP(char *);}
  14. extern "C" {void Set_Screen_Mode(int);}
  15.  
  16. void main(void)
  17. {
  18.    int error_code=0;
  19.  
  20.    error_code = Show_CAP("SAMPLE.CAP");             // Show "SAMPLE.CAP"
  21.  
  22.    if (error_code==0) getch();            // If no error, wait for a key
  23.    Set_Screen_Mode(3);                 // Switch back to color text mode
  24.  
  25.    switch(error_code) {
  26.       case 1: cout << "ERROR: The image file is not in CAP format!\7\n";
  27.               break;
  28.       case 2: cout << "ERROR: File I/O error or file not found!\7\n";
  29.               break;
  30.       case 3: cout << "ERROR: Not enough memory!\7\n";
  31.               break;
  32.       case 4: cout << "ERROR: This file can't be shown in Chinese system!\7\n";
  33.               break;
  34.    }
  35. }
  36.