home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / database / tdb / demo / units05.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-04-27  |  2.4 KB  |  79 lines

  1. { ──────────────────────────────────────────────────────────────── }
  2. {              TESTPROGRAMM NULL-TERMINATED-STRINGS                }
  3. { ──────────────────────────────────────────────────────────────── }
  4. { Testet die Routinen aus dem Modul "AStrings".                    }
  5. { ──────────────────────────────────────────────────────────────── }
  6. { Ein Wort zu GETMEM, FREEMEM, NEW, DISPOSE, MEMAVAIL und Konsor-  }
  7. { ten unter Windows: die Speicherverwaltung ist hier "etwas an-    }
  8. { ders" als unter DOS - wenn also ab und zu wieder einmal 60 Byte  }
  9. { oder so fehlen, so bin nicht (!) ich schuld !                    }
  10. { ──────────────────────────────────────────────────────────────── }
  11. {         (c)   Aurora featuring Markus SCHWAIGER 1992             }
  12. { ──────────────────────────────────────────────────────────────── }
  13. {     History:                                                     }
  14. {  Datum     / Bearb. / Art                                        }
  15. { 26. 4.1992    MS       Beginn Implementation.                    }
  16. { ──────────────────────────────────────────────────────────────── }
  17.  
  18. {$UNDEF Windows}
  19.  
  20. PROGRAM StrgTest;
  21.  
  22.   USES
  23. {$IFDEF Windows}
  24.     WINCRT,
  25.     STRINGS,
  26. {$ELSE}
  27.     CRT,
  28. {$ENDIF}
  29.     AStrings;
  30.  
  31.   VAR
  32.     PC1,
  33.     PC2,
  34.     PC3,
  35.     PC4,
  36.     PC5            : PChar;
  37.     S              : STRING;
  38.  
  39.   BEGIN
  40.     CLRSCR;
  41.     WRITELN;
  42.     WRITELN;
  43.  
  44.     WRITELN (MEMAVAIL);
  45.  
  46.     S := 'Hello world !';
  47.  
  48.     PC1 := StrPasNew (S);
  49.     PC2 := StrNew (PC1);
  50.     PC3 := Nil;             { PChar-Variablen werden durch StrMove }
  51.                             { nicht initialisiert, wenn nicht Nil. }
  52.     S := 'What''s going on ?';
  53.     StrMove (PC3, @S [1], LENGTH (S));
  54.  
  55.     PC4 := Nil;                         { Selbiges gilt für StrCat }
  56.     StrCat (PC4, PC2);
  57.     StrCat (PC4, PC3);
  58.  
  59.     PC5 := Nil;                        { Selbiges gilt für StrLCat }
  60.     StrLCat (PC5, PC2, 6);
  61.     StrLCat (PC5, PC3, 7);
  62.  
  63.     WRITELN (StrLen (PC1), '   <', StrPas (PC1), '>');
  64.     WRITELN (StrLen (PC2), '   <', StrPas (PC2), '>');
  65.     WRITELN (StrLen (PC3), '   <', StrPas (PC3), '>');
  66.     WRITELN (StrLen (PC4), '   <', StrPas (PC4), '>');
  67.     WRITELN (StrLen (PC5), '   <', StrPas (PC5), '>');
  68.  
  69.     StrDispose (PC1);
  70.     StrDispose (PC2);
  71.     StrDispose (PC3);
  72.     StrDispose (PC4);
  73.     StrDispose (PC5);
  74.  
  75.     WRITELN (MEMAVAIL);
  76.  
  77.     READKEY;
  78.   END. { PROGRAM StrgTest }
  79.