Re: scannerWithString
Re: scannerWithString
- Subject: Re: scannerWithString
- From: Ondra Cada <email@hidden>
- Date: Fri, 24 May 2002 14:53:46 +0200
On Friday, May 24, 2002, at 02:27 , zauhar wrote:
NSString *typeContents ;
NSArray *typeLines ;
// Get the file contents -----
typeContents = [ [ NSString alloc ] initWithContentsOfFile:f ] ;
// Divvy the file contents (lines) into an array of NSstrings
using \n as separator
typeLines = [ typeContents componentsSeparatedByString:@"\n" ] ;
Incidentally... in this context you *probably* wanted [NSString
stringWithContentsOfFile:f] (which automatically autoreleases the string)
instead of the alloc/init mantra. Although one can't say for sure without
seeing your complete code, there's a high probability this is a memory
leak.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.