ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Examples/MiscLogFile/LogFileTest.m

This is LogFileTest.m in view mode; [Download] [Up]

//
// LogFileTest.m -- test out the log file class
//		Written by Don Yacktman Copyright (c) 1993 by Don Yacktman.
//				Version 1.0.  All rights reserved.
//
//		This notice may not be removed from this source code.
//
//	This program is included in the MiscKit by permission from the author
//	and its use is governed by the MiscKit license, found in the file
//	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
//	for a list of all applicable permissions and restrictions.
//	

#import <misckit/misckit.h>
#import <appkit/appkit.h>
#import <stdio.h>

void main()
{
	id logFile = [[MiscLogFile alloc] init];
	id theLine = [[MiscString alloc] init];
	int i;
	[logFile setFileName:[[MiscString alloc] initString:"sample.log"]];

	[theLine setStringValue:"This is the first line.\n"];
	[logFile addLineToLogFile:theLine];
	[theLine setStringValue:"Repeat this line four times.\n"];
	[logFile openFile];
	for (i=0; i<4; i++) [logFile appendToLogFile:theLine andFlush:NO];
	[theLine setStringValue:"Repeat this line twice.\n"];
	[logFile appendToLogFile:theLine andFlush:NO];
	[logFile appendToLogFile:theLine andFlush:NO];
	[logFile closeFile];
	[theLine setStringValue:"Repeat this new line twice.\n"];
	[logFile openFile];
	[logFile appendToLogFile:theLine andFlush:NO];
	[logFile appendToLogFile:theLine andFlush:NO];
	[theLine setStringValue:"And this line three times.\n"];
	for (i=0; i<3; i++) [logFile appendToLogFile:theLine andFlush:YES];
	[logFile closeFile];
	[theLine setStringValue:"This is the last line.\n"];
	[logFile addLineToLogFile:theLine];
	system("cat sample.log");
	
	exit(0);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.