<?
/********************************************
*
* Examples for file handling class
*
*/
include("file.class.php"); // Including file class
// $file=new file("test.swf",true); // Creating an instace of class for binary files
$file=new file("test.txt"); // Creating an instace of class
/***
* Debug mode:
*
* If debug mode is switched on, the script will stop at each error and the error will be printed out to screen
*/
$file->debug_mode(); // Switching on debug mode
// Geting file pointer and printing out
//echo $file->pointer_get();
// Setting file pointer to 5
//$file->pointer_set(5);
// Writing data to file on actual pointer position
$file->write("dertest01\r\n");
// Getting data from line to line
while($line=$file->read_line()){
echo $line."\n";
}
// Getting data in an exact position
echo $file->read_bytes(5,0);
// Copying file
echo $file->copy("test_destination.txt");
// Getting file name and printing out
echo $file->get_name()."\n";
// Getting file size and printing out
echo $file->get_size()."\n";
// Getting owner id of file and printing out
echo $file->get_owner_id()."\n";
// Getting group id of file and printing out
echo $file->get_group_id()."\n";
// Getting suffix of file and printing out
echo $file->get_suffix()."\n";
?>
|