Login   Register  
PHP Classes
elePHPant
Icontem

File: example01.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of zandor  >  CFile  >  example01.php  >  Download  
File: example01.php
Role: Example script
Content type: text/plain
Description: simply creating, opening and closing a file
Class: CFile
Read and write values to binary files
Author: By
Last change:
Date: 3 years ago
Size: 730 bytes
 

Contents

Class file image Download
<?php // example 01 : simple open and close
      
require_once( "cfile.class.php" );
      
      echo 
"<b>EXAMPLE 01</b>: simply creating, opening and closing a file<br><br>" ;
      
      
$CANDIDATEfile "cfile.test.example01.txt" ;

      
$cfile = new cfile$CANDIDATEfile );
      
$bOPEN $cfile->openCFILE_READWRITE_CREATE_MODE );
      
$bERR $cfile->is_error() ;
      
      if ( 
$bOPEN && !$bERR // you can check open return value or internal error for safe operation
      
{
          echo 
"OPEN FILE $CANDIDATEfile : SUCCESS<br>" ;
          echo ( 
$cfile->close() ) ? "CLOSE FILE $CANDIDATEfile : SUCCESS" $cfile->get_error_string() ;
      }
      else echo 
$cfile->get_error_string() ;
?>