Hmm, I'm having some trouble with this.
I want to check if the second argument (argv[1]) is equal to "-debug".
so what I've done is...well, see below. None of the if statements register as true.
None of them work! The middle one with the \0 should...I tested it manually to make sure that letter was a \0, and it is. What's wrong with this?Code:char *debugArg = argv[1]; if (debugArg == "-debug") if (debugArg == "-debug\0") if (debugArg == "-debug\n")
The only solution I have right now is, unfortunately,:
...but that kinf of sucks. What's the solution to this? Maybe I could use strings somehow...Code:if (debugArg[0] == '-' && debugArg[1] == 'd' && debugArg[2] == 'e' && debugArg[3] == 'b' && debugArg[4] == 'u' && debugArg[5] == 'g')
--Ashiq