need some quick help (c++ segmentation fault)

Discussion in 'Computer Programming, Emulation, and Game Modding' started by Nyap, Jun 16, 2016.

  1. Nyap
    OP

    Nyap HTML Noob

    Banned
    973
    344
    Jan 13, 2016
    That Chaos Site
    The problem lies in these two lines
    Code:
    if (strcmp(argv[1], "DEBUG") == 0)
      aiTurn(gamedata);
    help
     
  2. Nyap
    OP

    Nyap HTML Noob

    Banned
    973
    344
    Jan 13, 2016
    That Chaos Site
    ok some more info
    when I look at this line:
    Code:
    if(strcmp(argv[1],"DEBUG")==0)
    and change the number in the subscipt in argv[HERE] the segfault seems to dissapear for some reason

    edit: ok, I'm stupid. It's because when you didn't pass the "DEBUG" argument it would basically try and compare it to garbage, which is what caused the segmentation fault
     
    Last edited by Nyap, Jun 16, 2016