Searching...
Monday 8 October 2012

Php Fseek Example

10:32 pm

Php Fseek Example

Php Fseek Example :

Fseek():  this function seeks in an open file. This function moves the file pointer from its current position to a new position, forward or backword specified by the number of bytes. This function returns 0 on success, or -1 on failure. Seeking past EOF will not generate an error.
         Fseek(file handle,offset)

Is_dir(file)
Is_executable(file)
Is_file(file)
Is_readable(file)
Is_uploaded_file(file)
Is_writable(file)/is_writable(file)


Fstat():  this function returns information about a file.this function returns an array with divice number,inode number,inode protection mode,userid,group id,inode device type, size of file,creation,last access/modified time, block size, no.of blocks etc.
              Fstat(file resource)
<?php

$file = fopen("india.txt", "r");
$details = fstat($file);
print_r($file);
?>
OutPut:
Resource id #3

Unlink(file name) :  this function deletes a file.

<?php

$file ="india.txt";
if(unlink($file))
{
    echo"deleted file $file";
}
?>
OutPut:
deleted file india.txt

0 comments:

Post a Comment