Segmentation Fault (Core Dumped) on cin.getline
I'm trying to pull in a line of input code and put it into a char*, but I keep getting a Seg Fault (core Dumped) error.
All I want to do is pull the line in, then check if it is actually an Int, then store it and push it on.
By the way, if it looks funny its because I'm doing this in through bison $$ = N_INPUT_EXPR, $1 = T_INPUT.
N_INPUT_EXPR : T_INPUT
$$.data.s = NULL;
std::cin.getline( $$.data.s, 256);
if(DEBUG) std::cout << "Data Recieved" << endl;
if( $$.data.s == '+' || $$.data.s == '-')
if(DEBUG) std::cout << "INT INPUTED" << endl;
$$.type = INT;
$$.data.i = atoi($$.data.s);
Can Anyone think why it would do this and how I can fix it.
Topic archived. No new replies allowed.