Re: PHP

From: Spock (spock@bfs.cz)
Date: 06. 07. 2000, 20:11 CEST


>Potreboval bych vedet, jak pomoci PHP cist a psat do souboru 
>binarne. Zatim se mi povedlo jenom cist a psat stringy.
>Diky Hellish

vzdyt to je v pohode. string spolkne cokoliv. :) proste pises do fajlu
n bytes nebo naopak n bytes ctes. btw: fwrite vraci prave pocet
zapsanych bytes. pridavam kousek manualu... :))

string fread(int fp, int length);
----------------------------------------
fread() reads up to length bytes from the file pointer referenced
by fp. Reading stops when length bytes have been read or EOF
is reached, whichever comes first.

int fwrite(int fp, string string, int [length]);
------------------------------------------------------
fwrite() writes the contents of string to the file stream pointed to
by fp. If the length argument is given, writing will stop after length
bytes have been written or the end of string is reached, whichever
comes first.

int fseek(int fp, int offset);
-----------------------------------
Sets the file position indicator for the file referenced by fp to
offset bytes into the file stream. Equivalent to calling (in C)
fseek( fp, offset, SEEK_SET ). Upon success, returns 0;
otherwise, returns -1. Note that seeking past EOF is not
considered an error.

int ftell(int fp);
---------------------
Returns the position of the file pointer referenced by fp; i.e.,
its offset into the file stream. If an error occurs, returns false.

int rewind(int fp);
--------------------------
Sets the file position indicator for fp to the beginning of the
file stream. If an error occurs, returns 0.


bye, spock.



This archive was generated by hypermail 2.1.2 : 04. 09. 2001, 02:52 CEST