Not sure what you're asking exactly, but strcmp() returns 0 when its string are equal and a non-zero value when they are not. So given two strings, s1 and s2:
if (strcmp(s1,s2)==0)
puts("equal"
else if (strcmp(s1,s2)>0)
puts("s1 greater than s2"
else
puts("s2 greater than s1"
By that, if true is 0 and false is 1 then
I'm doing this :
note that var3_4 = 01
if (strcmp(var3_4,"00" != 0 )
(...)
The != should validade both < and > but it didn't seem to work right.
What i want to do is as condition for situations where var3_4 is not equal to "00".
Assuming that tokens[3] contains "1234567890"
following happens:
after strcpy(xpto, tokens[3]) xpto has "1234567890"
after strncpy(var3_4, xpto+2, 2) var3_4 has "34..garbage.." - do not forget that strncpy does not insert terminating 0.
What about var1_2 - you don't show how it is populated.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.