Jump to content

Call a foreign-language function: Difference between revisions

m
Line 880:
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
}
719

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.