Originally Posted by
weez
My first thoughts to the appraoch was to convert the array to a string then strcmp but i cant seem to find how to connvert an array to a string either.
Anything that can be printed by a sequence of printf's can also be combined into a string using sprintf. Here is one way to do it:
Suppose you can print this sequence
Code:
printf("Hello");
printf(", ");
printf("World");
printf("!!");
Then to put it in a string instead, do this:
Code:
char result[1000];
char *s = result;
s += sprintf(s, "Hello");
s += sprintf(s, ", ");
s += sprintf(s, "World");
s += sprintf(s, "!!");
The destination result must have enough room, and each of the sprintf calls must return no error.