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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
N_INPUT_EXPR    : T_INPUT
			{
			printRule("INPUT_EXPR", "input");
                        $$.data.s = NULL;
                        std::cin.getline( $$.data.s, 256);
                        if(DEBUG) std::cout << "Data Recieved" << endl;
                        if( $$.data.s[0] == '+' || $$.data.s[0] == '-')
                        {
                          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.