Segmentation fault depending on string length?

后端 未结 2 996
后悔当初
后悔当初 2021-01-27 01:08

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

2条回答
  •  不要未来只要你来
    2021-01-27 01:37

    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.

提交回复
热议问题