12.12.2012, 00:40
You can do a while loop with the function fread, like so
Now. The content of the while loop is where you extract the information from the line. The way it's formatted, the delimiter for each information is ", ". To get each and every data by know the delimiter, you can either use a custom function called "split" (search for it) or you can use sscanf by ******:
EDIT
Do not under ANY circumstances use my code as 1. It won't probably work. 2. It's full of flaws.
Just use my code as an "inspiration" and try searching for similar codes. I recommend searching for the keywords "sscanf fread delimiter enum"
pawn Код:
new
string[ 128 ]; //I'm only making 128 cells to be sure you can fit an entire line of the txtfile
while( fread( hFile, string )) //This will read line-by-line and store the line being read at the moment into the variable 'string'
{
}
pawn Код:
for(new i = 0; i < MAX_PROPS; i++) //replace MAX_PROPS with the number of props you've got
{
sscanf( string, "e<p<, >s[24]fffiiis[24]>", PropInfo[i] ); //this will store all the info into propinfo
//do your stuff
}
Do not under ANY circumstances use my code as 1. It won't probably work. 2. It's full of flaws.
Just use my code as an "inspiration" and try searching for similar codes. I recommend searching for the keywords "sscanf fread delimiter enum"