Why are you checking the string after using the sprintf function? Why not just test the actual output from the nowtime.hour() and nowtime.minute() functions? You could read them into their own variables, print out the hour and minute and check them like this.
ookid:
Why are you checking the string after using the sprintf function? Why not just test the actual output from the nowtime.hour() and nowtime.minute() functions? You could read them into their own variables, print out the hour and minute and check them like this.
You're not comparing strings, you're comparing pointers to blocks of memory that contain strings. It will always be false unless you compare the string with itself.
You should use the function strcmp(a, b) to compare strings. It returns <0 if a is alphabetically less than b, >0 if a is alphabetically greater than b, and 0 if they are the same.
majenko:
You're not comparing strings, you're comparing pointers to blocks of memory that contain strings. It will always be false unless you compare the string with itself.
You should use the function strcmp(a, b) to compare strings. It returns <0 if a is alphabetically less than b, >0 if a is alphabetically greater than b, and 0 if they are the same.