home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l217 / 2.ddi / FOREIGN / TC / CTEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-26  |  1.5 KB  |  67 lines

  1. /***************************************************************************
  2.  
  3.  
  4.                PDC Prolog
  5.  
  6.              Copyright (c) 1986, 90 by Prolog Development Center
  7.  
  8.  
  9.  FileName: CTEST.C
  10.  PURPOSE: Demo program
  11.  
  12.  ═══════════════╦══════╦════════════════════════════════════════════════════
  13.   Date Modified,║ By,  ║  Comments.
  14.  ═══════════════╬══════╬════════════════════════════════════════════════════
  15.                 ║      ║
  16. ***************************************************************************/
  17.  
  18. #include <dos.h>
  19. #include <alloc.h>
  20. #include <stdio.h>
  21. #include <string.h>
  22.  
  23.  
  24. /***************************************************************************
  25.     Test Example
  26. ***************************************************************************/
  27.  
  28. /* Exported from Prolog test module */
  29. void write_string(char *);
  30. void write_storage_left(void);
  31. void write_double(double);
  32. void test_for_keypressed(void);
  33. void write_char(char);
  34. void mk_prolog_file(void);
  35. void wait(char*);
  36.  
  37. void testproc(void)
  38. {
  39.   FILE *in;
  40.   char line[80];
  41.  
  42.   wait("Hello now we are in C again, test allocation");
  43.  
  44.   write_storage_left();
  45.  
  46.   wait("Now we allocate 1000 bytes");
  47.  
  48.   (void)malloc(1000);
  49.  
  50.   write_storage_left();
  51.  
  52.   wait("Test file system");
  53.  
  54.   mk_prolog_file();
  55.  
  56.   if ((in = fopen("mytest.txt", "rt")) == NULL)
  57.     write_string("unable to open mytest.txt");
  58.   else
  59.   {
  60.     while (fgets(line, 79, in) != NULL)
  61.        write_string(line);
  62.     fclose(in);
  63.   }
  64.  
  65.   wait("Goodbye from C sub function");
  66. }
  67.