Environment: any ANSI C++-compilant compiler.
A common way of dealing with file I/O in the Windows environment is utilizing MFC's CFile class. But what if you, a professional win32 programmer, are having trouble in programming file operations under Linux, Solaris, or another UNIX system? What if you just don't want to mess with those heavyweight MFC classes?
- The 'File' class utilizes ANSI C++ I/O functions only (I hope.), so it is absolutely portable. There should be no problem in using it on a variety of platforms.
- Works faster and consumes less memory than MFC's CFile.
- Class interface is identical to MFC's CFile.
- Look at the documentation (PortableFileClass.hpp file) for some advanced routines.
- The 'File' class is missing routines that deal with file status.
- Rough changing of file size is not yet implemented.
- Error handling is not perfect yet...
- #include file "PortableFileClass.hpp" to your application's main .cpp file.
where myFileObject is a placeholder for the name of your file object.
- PortableFileClass.hpp file cantains all the required documentation—look at the very beginning of a file.
DownloadsDownload demo project - 1.7 Kb
Download source - 3.2 Kb