Segmentation Fault at programme launch



  • I'm trying to get C++ code on my Debian machine. Using the GCC Compilator. He's compiling my code without mistakes and warnings, but at the time of the launch, I get a mistake. Segmentation fault♪ Googled this problem and found something. Suggest that the debag programme be implemented through the GDB. What I did:

    gcc /путь_к_программе -g
    gdb ./a.out
    run
    backtrace
    

    In the end, debagger told me that there was a mistake in this section of the code:

    while(fgets(strLine, 256, list_fd) != NULL)
        {
                ParseResolverLine(strLine, iLine);
                iLine++;
        }
    

    Delivery of the debagger himself:

    #0  _IO_fgets (buf=0x607010 "", n=256, fp=0x0) at iofgets.c:50
    #1  0x000000000040185f in main (argc=6, argv=0x7fffffffec68)
    

    In fact, I don't know where the code is in the area I mentioned.



  • You. list_fd equal NULL (sighs)fp=0x0 in the sweet. Make sure the file's open if something doesn't work. fopen() returns NULL


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2