Here the ptr returned by MCStringGetCString will vanish so you need to strdup.