Hi Steve,
strdup() isn't a standard C function. I don't know if IBM C provides
it, Systems/C does.
However, you can easily include it in your source - in fact, it's
probably a good idea to provide a "compatibility" source full of
miscelleneous-but-helpful-functions-that-may-be-missing.
Here's a nice definition of strdup():
char *strdup(str)
const char *str;
{
size_t length;
char *result;
length = strlen(str) + 1;
result = malloc(length);
if(result != NULL) {
memcpy(result, str, len);
}
return result;
}
You could probably just slip this into your source somewhere, with
some #if checks to see if it's needed on a particular platform.
We're well aware of these, our software runs on 10 different
platforms (and we're adding more per user request.)
- Dave Rivers -
Steve Rawlins wrote:
Anybody use function "strdup" (malloc & duplicate a string) from an MVS "C"
program?
We are using C compiler V2 R10 OS/390 C on ZOS v1.4
and we are trying to keep our code cross-platform compatible.
Is strdup (string duplicate) function supported by MVS?
Thanks
Steve Rawlins
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
--
[EMAIL PROTECTED] Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html