Array as result of function
#2

pawn Код:
stock FUcitajNiz(a[][], nizfile[], &n, a_size = sizeof(a), a_len = sizeof(a[]))
{
    new UpisData[128];
    new File: UpisFajl;
    UpisFajl = fopen(nizfile, io_read);
    if(UpisFajl)
    {
        n = 0;
        while ( n < a_size && fread( UpisFajl , UpisData ) )
            strcat(a[n++], UpisData, a_len);

        fclose(UpisFajl);
    }
}
pawn Код:
new a[5][20],n;
FUcitajNiz(a, "file_name_here", n);

for(new i=0; i < n; i++)
    print(a[i]);
Reply


Messages In This Thread
Array as result of function - by ZeroOP - 17.08.2015, 08:28
Re: Array as result of function - by Jefff - 17.08.2015, 15:06

Forum Jump:


Users browsing this thread: 1 Guest(s)