home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc_prog / chap12 / test.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-04-07  |  807 b   |  34 lines

  1. /* test.c -- test the routines in basic.lib */
  2. /* Program list: test.c and basic.lib       */
  3.  
  4. #include <stdio.h>
  5.  
  6. main()
  7. {
  8.     static char string[] = "This is a test.";
  9.     char *cp, *Leftstr(), *Midstr(), *Rightstr();
  10.  
  11.     printf("Testing: \"%s\"\n", string);
  12.  
  13.     if ((cp = Leftstr(string, 4)) == NULL)
  14.         {
  15.         printf("Error in Leftstr()\n");
  16.         exit(1);
  17.         }
  18.     printf("Leftstr() returned: \"%s\"\n", cp);
  19.  
  20.     if ((cp = Midstr(string, 4, 5)) == NULL)
  21.         {
  22.         printf("Error in Midstr()\n");
  23.         exit(1);
  24.         }
  25.     printf("Midstr() returned: \"%s\"\n", cp);
  26.  
  27.     if ((cp = Rightstr(string, 5)) == NULL)
  28.         {
  29.         printf("Error in Rightstr()\n");
  30.         exit(1);
  31.         }
  32.     printf("Rightstr() returned: \"%s\"\n", cp);
  33. }
  34.