Reading from a file.
#1

Hello!

I have a question, how can I read from a file.
For example, in a file I have:

pawn Code:
Question = 12345
And, I want a function like:

pawn Code:
Read(filename[], text[]
Something like:

pawn Code:
new file[50];
format(file, ........................);
Add(file, "Question", 12345);
Read(file, Question);
And this function should return me 12345.

I tried, but I don't know how to continue.

pawn Code:
stock h_Read(filename[], text[])
{
    new string[50];
    if(!fexist(filename)) return false;
    new File:file = fopen(filename, io_read);
    while(fread(file, string))
    {
    }
    return false;
}
I looked into dini, but cannot understand what Dracoblue did.
+ Rep!
Reply


Messages In This Thread
Reading from a file. - by HY - 14.03.2015, 21:16
Re: Reading from a file. - by Abagail - 14.03.2015, 21:25
Re: Reading from a file. - by HY - 14.03.2015, 21:33
AW: Re: Reading from a file. - by Nero_3D - 14.03.2015, 21:38
Re: Reading from a file. - by Abagail - 14.03.2015, 21:41

Forum Jump:


Users browsing this thread: 1 Guest(s)