Search:

Type: Posts; User: JohnGraham

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    28,367

    Ah, I thought strdup() was a C standard function...

    Ah, I thought strdup() was a C standard function - turns out it's a POSIX/BSD function. You can easily implement it with something like:



    #include <stdlib.h>
    #include <string.h>

    char...
  2. Replies
    5
    Views
    28,367

    I'm surprised that doesn't segfault... you'll be...

    I'm surprised that doesn't segfault... you'll be stuffing however many characters you get into `name', which is a variable that can hold a single char... bound to be bad. Also, strcpy() won't work,...
Results 1 to 2 of 2