C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
_strdup Functions
 Summary Example                         Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
     The _strdup family of functions operates on null-terminated
     strings. The <string> arguments to these functions are expected to
     contain a null character (\0) marking the end of the string.
 
     The _strdup function allocates storage space (with a call to
     malloc) for a copy of <string>, and returns a pointer to the
     storage space containing the copied string. The function returns
     NULL if storage cannot be allocated.
 
     The _fstrdup and _nstrdup functions provide complete control over
     the heap used for string duplication. The regular _strdup function
     returns a pointer to a copy of the <string> argument. The space
     for the string is allocated from the heap specified by the memory
     model in use. In large data models (that is, compact-, large-, and
     huge-model programs), _strdup allocates space from the far heap.
     In small data models (tiny-, small-, and medium-model programs),
     _strdup allocates space from the near heap.
 
     The _fstrdup function returns a pointer to a copy of the string
     allocated in far memory (the far heap), and _nstrdup allocates
     space for the copy from the near heap.
 
     Return Value
 
     The return values for these functions are described above.
                                    -♦-