[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Small code causing segfault



Newbie to c++, just wondering if anyone can help explain why I get a
segfault when running this with 'bame' = /home/username/
Thanks.

#include <stdlib.h>
#include <iostream.h>

int main()
{
        const char *name = "BIGTEST";
        char *bame;
        cin >> bame;
        setenv(name,bame,1);
        system("find $BIGTEST");
        return(0);
}



Visit your host, monkey.org