avd avd - 1 year ago 123
C++ Question

Strange segmentation fault C++ in _vfprintf_r()

Someone please see my code at this link for input taken from this file( 2.2 mb file). This produces seg fault. By gdb, it shows seg fault in _vfprintf_r(). But when I comment line 41 and uncomment 38 (a null statement), there is no segmentation fault. line no 41 is just print statement. Someone please help. I am frustated and wasted a day in debugging. The output is written into result.txt file.

Answer Source

You have a stack overflow. That's right, a Stack Overflow. I was able to reproduce by doing ulimit -s 1024. You need to not recurse so deeply, or you need to increase your stack size.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download