• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: scannerWithString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Follow-Ups:
    • Re: scannerWithString
      • From: zauhar <email@hidden>
References: 
 >Re: scannerWithString (From: zauhar <email@hidden>)

  • Prev by Date: Re: scannerWithString
  • Next by Date: Very long floating point numbers
  • Previous by thread: Re: scannerWithString
  • Next by thread: Re: scannerWithString
  • Index(es):
    • Date
    • Thread