Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

File Class Reference
[Files]

A class for working with files (a wrapped to FILE *). More...

#include <gmlfile.h>

List of all members.

Methods

bool Open (const char *mode)
 Opening of file according to mode. The list of allowed modes:.

bool Opened () const
 True if file was previously opened.

bool Close ()
 Close the file.

bool ReadStr (String &out_buff, int len_buff, bool *out_nl=NULL)
bool ReadStr (char *out_buff, int len_buff, bool *out_nl=NULL)
bool ReadStr (String &out_buff)
void Read (BYTE *out_buff, int len_buff, int &out_size)
void WriteStr (const String &str)
void WriteStr (const char *out_buff,...)
void Write (const BYTE *buff, int size)
void Flush ()
bool Remove ()
bool Rename (const PathString &new_file_name)
bool IsError ()
PathString PathName () const
int Printf (const char *format,...)
bool Seek (long offset)
bool SeekCur (long offset)
bool SeekEnd (long offset)
long FilePos () const
 Gets current file offset.

long FileSize () const
 Returns the size of the file in bytes.

bool Copy (const PathString &name_from, const PathString &name_to)
enum  { MODE_TEXT, MODE_BINARY }
enum  { MODE_READ, MODE_WRITE, MODE_READ_WRITE }
FILE * fd
int mode_tb
int mode_rw

Public Member Functions

Constructors
 File (const PathString &full_pathname)
 Sets a full path to the file only.

 File (const File &file)
 Copy constructor.

 ~File ()
 Destructor. File will be closed if it was opened.


Protected Types


Detailed Description

A class for working with files (a wrapped to FILE *).


Constructor & Destructor Documentation

File const File file  ) 
 

Copy constructor.

File may not be opened. Debug version asserts if this condition is violated.


Member Function Documentation

bool Open const char *  mode  ) 
 

Opening of file according to mode. The list of allowed modes:.

Parameters:
mode - i/o mode of the file to open
  • "r" - open for reading only; the file must exist.
  • "w" - create a new file or open an existing file for writing.
  • "a" - open for writing at the end-of-file or create for writing if the file does not exist.
  • "r+" - open an existing file for reading and writing.
  • "w+" - open an empty file for reading and writing.
  • "a+" - open for reading and appending; create a file if it does not exist.
Note:
Files are open in text mode as a default. Character 'b' may be appended to the above modes to open file in binary mode ('b' may also precede '+' sign). Path to file must be specified. Debug version asserts if this condition is violated.

bool Close  ) 
 

Close the file.

Returns:
  • true (if there were no problems when working with the file and the file was closed successfully).
  • false (either I/O error while working with file or closing error).
Note:
File must be opened. Debug version asserts if this condition is violated


The documentation for this class was generated from the following files:
Generated on Tue Jan 13 21:12:03 2004 for Graphics and Media Lab CSL by doxygen 1.3.4