Posts: 34
Threads: 7
Joined: Oct 2008
Hi, I've just a simple question for a simple little thing. Is it possible to read and print all lines from a file?
I use currently DINI, it would be really nice if someone give an example...
Posts: 553
Threads: 95
Joined: Sep 2013
Posts: 34
Threads: 7
Joined: Oct 2008
Quote:
Originally Posted by (SF)Noobanatior
if you look in dini.inc there is lots of examples of how to read a file or use file function
im a but rusty with it but i gutted dini_get to make this quickly
should print eack line of the file to the console (untested)
pawn Код:
public printfile(filename[]){ new File:fohnd; new tmpres[MAX_STRING]; fohnd=fopen(filename,io_read);//open file if (!fohnd) return 0; //end if dosent exist while (fread(fohnd,tmpres)) { //read each line print(tmpres); //print line } fclose(fohnd);//close file return 1; }
hope that helps
|
This helped me alot, thank you!