Re: Include an executable without hard coding the path
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