14.03.2015, 21:16
Hello!
I have a question, how can I read from a file.
For example, in a file I have:
And, I want a function like:
Something like:
And this function should return me 12345.
I tried, but I don't know how to continue.
I looked into dini, but cannot understand what Dracoblue did.
+ Rep!
I have a question, how can I read from a file.
For example, in a file I have:
pawn Code:
Question = 12345
pawn Code:
Read(filename[], text[]
pawn Code:
new file[50];
format(file, ........................);
Add(file, "Question", 12345);
Read(file, Question);
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;
}
+ Rep!