Array sizes do not match
#2

pawn Код:
stock CountrySearch(const string[])
{
    static
        x = sizeof (cntNames),
        results_found = 0,
        result_string[512],
        return_string[512 + 128];
    if (string[0] != EOS)
    {
        while (x >= 0)
        {
            if (strfind(cntNames[x], string, false) != -1)
            {
                results_found += 1;
                strcat(result_string, cntNames[x]);
                if (results_found > 1) strcat(result_string, "\n");
            }
            x -= 1;
        }

        if (results_found >= 0)
        {
            if (!results_found)
                format(return_string, sizeof (return_string), "No results found for '%s'.\nPlease check your spelling and try again.", string);

            if (results_found == 1)
                format(return_string, sizeof (return_string), "Did you mean: %s", result_string);

            else if (results_found <= 10)
                format(return_string, sizeof (return_string), "Did you mean one of these?\n%s", result_string);

            else
                format(return_string, sizeof (return_string), "Did you mean one of these?\n%s\nNOTE: Only the first 10 results are shown, the rest is cut off.", result_string);

        }
    }
    return return_string;
}
Reply


Messages In This Thread
Array sizes do not match - by Jack_Leslie - 20.12.2011, 11:42
Re: Array sizes do not match - by FarSe. - 20.12.2011, 12:21

Forum Jump:


Users browsing this thread: 1 Guest(s)