Top "Strdup" questions

The strdup() function duplicates a string

strdup() - what does it do in C?

What is the purpose of the strdup() function in C?

c function strdup
strcpy vs strdup

I read that strcpy is for copying a string, and strdup returns a pointer to a new string to duplicate …

c strcpy strdup
strdup or _strdup?

When I use strdup in Microsoft Visual C++, it warns me: warning C4996: 'strdup': The POSIX name for this item …

c++ c visual-studio strdup
How do I use strdup?

I am calling strdup and have to allocate space for the variable before calling strdup. char *variable; variable = (char*) malloc(…

c malloc strdup
strdup() function

I recently became aware that the strdup() function I've enjoyed using so much on OS X is not part of …

c strdup
strdup(): Confused about warnings ('implicit declaration', 'makes pointer...without a cast', memory leak)

When I compile the short piece of code below (in which we define a string and then use strdup to …

c gcc valgrind strdup
How to avoid "null argument where non-null required" compiler warning

Compiling the following code: #include <string.h> #define FOO (NULL) int main(int argc, char *argv[]) { char *foo; …

c gcc-warning strdup
alternative to strdup

I'm writing a C++ class for a book that contains a name: class Book { private: char* nm; .......... ............ .......... ........... }; I am not …

c++ string dynamic-memory-allocation strdup
strdup error on g++ with c++0x

I have some C++0x code. I was able to reproduce it below. The code below works fine without -std=…

gcc c++11 g++ compiler-errors strdup
'memdup' function in C?

In C, you can use strdup to succinctly allocate a buffer and copy a string into it. As far as …

c memcpy strdup