print("file could not be opened");
}
?>
array fstat(integer file_handle)
The fstat function gets information from C's stat function about an open file and
returns it in an associative array. The elements of the array are atime, blksize, blocks,
ctime, dev, gid, ino, mode, mtime, nlink, rdev, size, uid. This function returns the
same information returned by stat and lstat.
integer ftell(integer file_handle)
Given a valid file handle, ftell returns the offset of PHP's internal file pointer. If you
wish to move the file pointer, use the fseek function.
<?
// open a file
if($myFile = fopen("data.txt", "r"))
{
//read characters until we find a space
$c = "";
while(!(feof($myFile)) AND ($c != " "))
{
$c = fgetc($myFile);
}
print("File pointer at ". ftell($myFile). " bytes");
}
else
{
print("file could not be opened");
}
?>
integer ftruncate(integer file_handle, integer size)
The ftruncate function truncates a file to a specified size, expressed in number of bytes.
integer fwrite(integer file_handle, string data, integer length)
The fwrite function writes a string to a file. It is similar to fputs, except that it is
binary-safe. The file_handle argument must be an integer returned by fopen,
fsockopen, or popen. The length argument is optional, but if present will cause the
magic quotes functionality to be suspended. This means backslashes inserted into the
string by PHP to escape quotes will not be stripped before writing.