All,
I come from java and php world so this maybe a factor. But I have a problem with:
printf("%s\n",data[0]);
if(data[0] == "BG01") {
printf("%s\n",otherstring);
}
The problem is that first printf returns in the console "BG01" but for some reason the IF condition doesn't pick up on it and the second printf never gets executed.
What's wrong with this picture?
Thanks, goe
The way you are doing it now is that you are comparing 2 pointers instead of the strings they point to. These pointers could point to the same value, but located in very different spots in memory and so be not true.
The way to do it is the use the strcmp(string1, string2) function which will check the strings themselves and not the pointers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With