PHP Classes

CFile: Read and write values to binary files

Recommend this page to a friend!
  Info   View files View files (20)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 381 All time: 6,706 This week: 238Up
Version License PHP version Categories
cfile 1.0GNU General Publi...4.0PHP 5, Files and Folders
Description 

Author

This class can read and write values to binary files.

It can perform several types of operations to access files like: open, read, write, seek the position of access to the files, set the little or big endian mode of the values to be read or written, and read or write integer, floating point, strings or array values.

Picture of Alessandro Rosa
Name: Alessandro Rosa <contact>
Classes: 10 packages by
Country: Italy Italy
Innovation award
Innovation award
Nominee: 3x

Details
CFILE (PHP) I needed something that worked fine, almost like the class CFile of MFC in Visual C++. I coded this class which basically does the same, even if not with the same efficiency, due to PHP limitations anyway. Developers can read and write data in both text and binary mode, so that they can store strings, numerical variables (integer and float) and arrays. They can also move the file pointer back and forth for anyneed. The attached examples cover simple file management, reading of file header structures (jpeg and bmp, here). Although they are rather n.aive, the goal of these examples is just to show the features of this class. Developers would benefit of this class for its potential functionalities.
  Files folder image Files  
File Role Description
Accessible without login Image file andromeda.bmp Output example picture
Accessible without login Image file andromeda.jpg Output sample picture
Accessible without login Plain text file cfile.class.php Class whole package
Accessible without login HTML file docs.html Doc. class members documentation
Accessible without login Plain text file example01.php Example simply creating, opening and closing a file
Accessible without login Plain text file example02.php Example creating a file, then we write in a double and an integer values
Accessible without login Plain text file example03.php Example creating a file, then writing in a string
Accessible without login Plain text file example04.php Example reading some fields in the JPEG header
Accessible without login Plain text file example05.php Example reading some fields in the BITMAP (.BMP) header
Accessible without login Plain text file example06.php Example read some fields in the BITMAP (.BMP) header and we raster an RGB bitmap picture in a HTML table, pixel by pixel
Accessible without login Plain text file example07.php Example read some fields in the BITMAP (.BMP) header and we raster an RGB bitmap picture in a HTML table, pixel by pixel
Accessible without login Plain text file example08.php Example reading some fields in the PNG header
Accessible without login Plain text file example09.php Example reading some fields in the GIF header
Accessible without login Plain text file example10.php Example writing & reading an input array into a file
Accessible without login Plain text file example11.php Example using static functions
Accessible without login Image file flowers.bmp Output sample picture
Accessible without login Image file flowers.gif Data gif file
Accessible without login Image file flowers.indexed.png Data indexed png with palette
Accessible without login Plain text file readme.txt Doc. Short description of all contents
Accessible without login Image file waves.bmp Output sample picture

 Version Control Unique User Downloads Download Rankings  
 0%
Total:381
This week:0
All time:6,706
This week:238Up