Reading from a file.
#5

You can use common string functions such as strdel, strpos, etc.

For instance,

pawn Code:
stock get_question_answer()
{
     new string[64] = file_get_contents("file.cfg");
     if(strfind(string, "Question") != -1)
     {
         strmid(string, strpos(string, strfind(string, "Question"), strfind(string, "Question"+MAX_SIZE), sizeof(string));
     }

     return string;
}
This would get everything after "Question" and extract it into the string. You'll need to specify a MAX_SIZE where it will stop extracting the string at.
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)