Re: Objective-C BufferedReader
Re: Objective-C BufferedReader
- Subject: Re: Objective-C BufferedReader
- From: Marten van Gelderen <email@hidden>
- Date: Sun, 13 Feb 2005 16:00:53 +0100
Hamish,
An alternative way might be the following:
- (void)fileScannerAtPath:(NSString *)filePath
{
if ([[NSFileManager defaultManager] isReadableFileAtPath:
filePath]) {
NSString *fileContents = [NSString stringWithContentsOfFile:
filePath];
unsigned int fileLength = [fileContents length];
NSRange lineRange = NSMakeRange(0, 0);
NSScanner *lineScanner;
while (lineRange.location < fileLength) {
lineRange = [fileContents lineRangeForRange: lineRange];
lineScanner = [NSScanner scannerWithString: [fileContents
substringWithRange: lineRange]];
/* scan something in the lineScanner and do something with it ...
*/
lineRange = NSMakeRange(NSMaxRange(lineRange), 0);
}
}
}
On 12 Feb 2005, at 23:39, Hamish Allan wrote:
Hi,
I have as yet been unable to find anything written in Objective-C that
provides the functionality of Java's java.io.BufferedReader.
1) Does such a library object exist, and if so, where?
--
Groeten, Marten
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden