21 lines
476 B
Plaintext
21 lines
476 B
Plaintext
include "NSLog.incl"
|
|
|
|
BeginCDeclaration
|
|
char *strdup(const char *src);
|
|
EndC
|
|
|
|
BeginCFunction
|
|
char *strdup(const char *src) {
|
|
char *dst = malloc(strlen (src) + 1); // Space for length plus null
|
|
if (dst == NULL) return NULL; // No memory
|
|
strcpy(dst, src); // Copy the characters
|
|
return dst; // Return the new string
|
|
}
|
|
EndC
|
|
|
|
BeginCCode
|
|
NSLog( @"%s", strdup( "Hello, World!" ) );
|
|
EndC
|
|
|
|
HandleEvents
|