== on two strings compares their addresses, not their text, so two equal strings in different buffers look different. strcmp(a, b) compares the text and returns 0 when they are equal, a negative number when a sorts first and a positive one otherwise.
strchr(s, c) returns a pointer to the first c in s, or NULL; subtracting s from it gives the index. strtol(text, &end, 10) converts text to a number and sets end to where the digits stopped, which tells you whether the whole text was a number. atoi cannot tell you that.
To build text into a buffer, use snprintf(buffer, size, format, ...). It never writes more than size bytes, including the terminator, and cuts the text instead. sprintf has no size and writes past the end of a small buffer.