Little help with strmid
#3

I don't think it's a good idea to use ini files for something like this. The name of the key is not important and therefor using ini is pointless. Using plain text file:
Код:
fuck
shit
bitch
pawn Код:
new
    File:handle = fopen("FAdmin/Logs/Forbidenwords.txt", io_read),
    word[32],
    i;

if(handle)
{
    while(fread(handle, word))
    {
        if(i >= sizeof(ForbiddenWords)) // Out of bounds protection
        {
            printf("Warning: Could not load more than %d words. Destination array is too small!");
            break;
        }
        strcpy(ForbidenWords[i], word);
        i++;
    }
    fclose(handle);
    printf("Words loaded: %d", i);
}
else printf("Forbidden words file not found, or it could not be opened!");
pawn Код:
stock strcpy(dest[], const source[], maxlength=sizeof dest)
{
    strcat((dest[0] = EOS, dest), source, maxlength);
}
I just typed this out of my head, but I think it would work.
Reply


Messages In This Thread
Little help with strmid - by FireCat - 07.09.2011, 11:22
Re: Little help with strmid - by [WSF]ThA_Devil - 07.09.2011, 11:29
Re: Little help with strmid - by Vince - 07.09.2011, 11:56

Forum Jump:


Users browsing this thread: 2 Guest(s)