home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
me34src.zip
/
me3
/
util
/
savestr.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-14
|
414b
|
16 lines
/* savestr.c: Save a string by malloc()ing space and coping the string.
* Returns a pointer to the malloc()ed string.
* This is a "black box" copy of a routine in Microsoft C.
* C Durland Public Domain
*/
#include "const.h"
char *savestr(str) char *str; /* malloc str and save it */
{
char *ptr, *malloc(), *strcpy();
if ((ptr = malloc(strlen(str)+1)) == NULL) return NULL;
return strcpy(ptr,str);
}