I am writing a program that will read lines from an infile using getline into strings, convert the strings to c-strings containing the first m nonwhitespace characters of the st
I am not sure why the backtrace is pointing to string input;
but when you are copying row
into map
. if mapsize is bigger than the size of row, you could well end up seg-faulting. This will be more common for a bigger mapsize.
you also may well be stomping over return addresses on the stack that could be causing the "wrong" core-dump.
map
is a VLA, allocated on the stack, so I'd guess that your problem is that you get a stack overflow. gdb points a the construction of input
because that's the first thing that gets constructed on this overflowed stack.