I have the following code:
printf("num: %d\n", strcasecmp(buf, "h\n"));
And I get the following results when I try plugging in different letters:
a: -7
g: -1
i: 1
j: 2
h: 156
H: 156
Should strcasecmp
not return 0 when buf is equal to H
or h
? Any ideas why it's returning 156? I need to figure out how to check whether the user types H or h.
Thanks!
Edit: I'm reading buf in the following way:
read(0, buf, MAXBUFLEN);