• 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: NSString is cutting off characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString is cutting off characters


  • Subject: Re: NSString is cutting off characters
  • From: Andreas Mayer <email@hidden>
  • Date: Sun, 16 Feb 2003 23:46:35 +0100

Am Sonntag, 16.02.03 um 22:39 Uhr schrieb Brian Ganninger:

gaugePath = [[NSString alloc] initWithString:percentUsed];
gaugePath = [gaugePath stringByAppendingPathExtension:@"tif"];

You have a memory leak here. You allocate a string and don't release it.

Make that first line

gaugePath = [[[NSString alloc] initWithString:percentUsed] autorelease];

or short:

gaugePath = [NSString stringWithString:percentUsed];

But, when I run the above code, or any other stringAppending technique I
could find, the following is what happens:
87.if

I don't know what's wrong with your code, but why don't you just do this:

gaugePath = [NSString stringWithFormat:@"%@.tif", percentUsed];

or even (assuming percent is an integer):

gaugePath = [NSString stringWithFormat:@"%i.tif", percent];


bye. Andreas.
_______________________________________________
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.

References: 
 >NSString is cutting off characters (From: Brian Ganninger <email@hidden>)

  • Prev by Date: Re: Shared Memory and Distributed Objects
  • Next by Date: Re: Get path to user preference folder, problem solved!
  • Previous by thread: Re: NSString is cutting off characters
  • Next by thread: FW: NSString is cutting off characters
  • Index(es):
    • Date
    • Thread