home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / daymisckit_proj / Examples / DAYLogFile / LogFileTest.m < prev    next >
Encoding:
Text File  |  1993-07-11  |  1.1 KB  |  36 lines

  1. // StringTest.m -- test out the String class
  2.  
  3. #import <daymisckit/daymisckit.h>
  4. #import <appkit/appkit.h>
  5. #import <stdio.h>
  6.  
  7. void main()
  8. {
  9.     id logFile = [[DAYLogFile alloc] init];
  10.     id theLine = [[DAYString alloc] init];
  11.     int i;
  12.     [logFile setFileName:[[DAYString alloc] initString:"sample.log"]];
  13.  
  14.     [theLine setStringValue:"This is the first line.\n"];
  15.     [logFile addLineToLogFile:theLine];
  16.     [theLine setStringValue:"Repeat this line four times.\n"];
  17.     [logFile openFile];
  18.     for (i=0; i<4; i++) [logFile appendToLogFile:theLine andFlush:NO];
  19.     [theLine setStringValue:"Repeat this line twice.\n"];
  20.     [logFile appendToLogFile:theLine andFlush:NO];
  21.     [logFile appendToLogFile:theLine andFlush:NO];
  22.     [logFile closeFile];
  23.     [theLine setStringValue:"Repeat this new line twice.\n"];
  24.     [logFile openFile];
  25.     [logFile appendToLogFile:theLine andFlush:NO];
  26.     [logFile appendToLogFile:theLine andFlush:NO];
  27.     [theLine setStringValue:"And this line three times.\n"];
  28.     for (i=0; i<3; i++) [logFile appendToLogFile:theLine andFlush:YES];
  29.     [logFile closeFile];
  30.     [theLine setStringValue:"This is the last line.\n"];
  31.     [logFile addLineToLogFile:theLine];
  32.     system("cat sample.log");
  33.     
  34.     exit(0);
  35. }
  36.