SA-MP Forums Archive
Tutorial on how to use? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Tutorial on how to use? (/showthread.php?tid=130221)



Tutorial on how to use? - Torran - 25.02.2010

Does anyone know of any tutorials on how to use fwrite/fread/fclose,
As im trying to make a admin script using it and dont really understand it,
So yeah does anyone know of any tutorials, IT HAS TO BE USING Fwrite


Re: Tutorial on how to use? - adsy - 25.02.2010

doesnt it work very similarly to the php functions?

http://php.net/manual/en/function.fwrite.php
http://php.net/manual/en/function.fread.php
http://php.net/manual/en/function.fclose.php

anyways

as i understand the php one a bit better i thought i would get the grand larceny load vehicles script from files

file_ptr = fopen(filename,filemode:io_read);
fread(file_ptr,line,256)
fclose(file_ptr);

right

fopen is assigned a variable so that it can be closed via a variable

(line is a variable too heres the pwn : new line[256]

what the fread line is doing is reading the first 256 lines which can contain a maximum of 256 characters

fclose obviously close the open file (assigned by fopen)


Re: Tutorial on how to use? - Torran - 25.02.2010

I dont know, Id really want it to be a tutorial for samp


Re: Tutorial on how to use? - BlackFoX - 25.02.2010

Код:
new File:myfile = fopen("File.ext",io_write);
fwrite(myfile,"Hello World");
fclose(myfile);
Код:
new File:myfile = fopen("File.ext",io_read),input[255];
fread(myfile,input); // It Read one Line...
/*while(fread(myfile,input)) ... Some code read all Lines */
fclose(myfile);



Re: Tutorial on how to use? - Fedee! - 25.02.2010

Use WIKII!!


Re: Tutorial on how to use? - Rzzr - 25.02.2010

First off: You already posted a topic with the same question before.
Second: I used the search function, and found this: http://forum.sa-mp.com/index.php?topic=69494.0
Hope it helped


Re: Tutorial on how to use? - Torran - 25.02.2010

Quote:
Originally Posted by [ST
DutchBas ]
First off: You already posted a topic with the same question before.
Second: I used the search function, and found this: http://forum.sa-mp.com/index.php?topic=69494.0
Hope it helped
No offence to everyone else, But everyone else said, Wiki, Search ect, I HAVE already done.. Anyway yeah that helps ty man


Re: Tutorial on how to use? - Fedee! - 25.02.2010

Quote:
Originally Posted by Torran
Quote:
Originally Posted by [ST
DutchBas ]
First off: You already posted a topic with the same question before.
Second: I used the search function, and found this: http://forum.sa-mp.com/index.php?topic=69494.0
Hope it helped
No offence to everyone else, But everyone else said, Wiki, Search ect, I HAVE already done.. Anyway yeah that helps ty man
Yeah, you searched alot...
https://sampwiki.blast.hk/wiki/Fwrite
https://sampwiki.blast.hk/wiki/Fclose
https://sampwiki.blast.hk/wiki/Fread



Re: Tutorial on how to use? - Torran - 25.02.2010

Quote:
Originally Posted by Fedee!
Quote:
Originally Posted by Torran
Quote:
Originally Posted by [ST
DutchBas ]
First off: You already posted a topic with the same question before.
Second: I used the search function, and found this: http://forum.sa-mp.com/index.php?topic=69494.0
Hope it helped
No offence to everyone else, But everyone else said, Wiki, Search ect, I HAVE already done.. Anyway yeah that helps ty man
Yeah, you searched alot...
https://sampwiki.blast.hk/wiki/Fwrite
https://sampwiki.blast.hk/wiki/Fclose
https://sampwiki.blast.hk/wiki/Fread
Dude, When have they been called tutorials? There examples..


Re: Tutorial on how to use? - adsy - 25.02.2010

Quote:
Originally Posted by [ST
DutchBas ]
First off: You already posted a topic with the same question before.
Second: I used the search function, and found this: http://forum.sa-mp.com/index.php?topic=69494.0
Hope it helped
this is the answering post