• 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: Include an executable without hard coding the path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Include an executable without hard coding the path


  • Subject: Re: Include an executable without hard coding the path
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 18 Jul 2009 20:36:49 -0700

On Jul 18, 2009, at 20:00, Rick Schmidt wrote:

So do be clear the concern is having a the chunk of memory that is holding the string being written too and overflowing?

It's mostly about whether the memory block holding the C-string will get deallocated before you or the library is finished with it.


Perhaps the simplest way to deal with it is to transform the problem into C-land where you have more familiarity, along this line (not tested):

	myNSString* = ...
	const char * myUTF8String = [myNSString UTF8String];
	char * myCString = malloc (strlen (myUTF8String) + 1);
	strcpy (myCString, myUTF8String);
	... pass myCString on to your library routine

Then all you have to worry about is when to 'free (myCString)' at some later time.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Include an executable without hard coding the path
      • From: Rick Schmidt <email@hidden>
References: 
 >Re: Include an executable without hard coding the path (From: Rick Schmidt <email@hidden>)
 >Re: Include an executable without hard coding the path (From: Scott Ribe <email@hidden>)
 >Re: Include an executable without hard coding the path (From: Rick Schmidt <email@hidden>)

  • Prev by Date: Re: Include an executable without hard coding the path
  • Next by Date: Re: Include an executable without hard coding the path
  • Previous by thread: Re: Include an executable without hard coding the path
  • Next by thread: Re: Include an executable without hard coding the path
  • Index(es):
    • Date
    • Thread