home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Reference_Library / lib_examples / istr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-21  |  1.1 KB  |  41 lines

  1. ;/* istr.c - Execute me to compile me with SAS C 5.10
  2. LC -b1 -cfis -j73 istr.c
  3. Blink FROM LIB:c.o,istr.o TO istr LIBRARY LIB:LC.lib,LIB:Amiga.lib
  4. quit
  5. */
  6.  
  7.     #include <exec/types.h>
  8.     #include <stdio.h>
  9.     #include <string.h>
  10.  
  11.     #include <clib/exec_protos.h>
  12.     #include <clib/utility_protos.h>
  13.  
  14.     void main(void);
  15.     struct Library *UtilityBase;
  16.  
  17.     void main(void)
  18.     {
  19.         UBYTE *butter = "Bøtervløøt";
  20.         UBYTE *bread = "Knåckerbrøt";
  21.         UBYTE ch1, ch2;
  22.         LONG result;
  23.  
  24.         /* Fails silently if < 37 */
  25.         if (UtilityBase = OpenLibrary("utility.library", 37))
  26.         {
  27.                 result = Stricmp(butter, bread);
  28.  
  29.                 printf("comparing %s with %s yields %ld\n", butter, bread, result );
  30.  
  31.                 result = Strnicmp(bread, butter, strlen(bread));
  32.  
  33.                 printf("comparing (with length) %s with %s yields %ld\n", bread, butter, result );
  34.  
  35.                 ch1 = ToUpper(0xE6); æ /* ASCII character 230 ae ligature */
  36.                 ch2 = ToLower(0xD0); Ð /* ASCII character 208 Icelandic Eth */
  37.  
  38.                 printf("Chars %c %c\n", ch1, ch2);
  39.         }
  40.     }
  41.