Standard Library
CBinaryFile Class
This class is inherited from
CFile
and provides several additional member functions and variables that access
binary data files of a static size. This base class must be inherited by a
class to access a specific binary data file. The member functions and
variables are as follows:
- CBinaryFile::CBinaryFile()
- This is the default constructor. It initializes the data
members. CBinaryFile::Record is set to NULL, and CBinaryFile::Length is
set to zero.
- CBinaryFile::CBinaryFile(char*Rec, int Len)
- This is the constructor to be used for creating a new file. It
initializes the data members. Also, CBinaryFile::Record is set to Rec, and
CBinaryFile::Length is set to Len.
- CBinaryFile::~CBinaryFile()
- This is the destructor. It deallocates the data members.
-
BOOL CBinaryFile::Open(CString FileName, char UserAccess)
- This member function opens the specified file with the specified
UserAccess. Specify the full path name in FileName. If UserAccess is
'R' (read) or 'B' (both), the current contents of the file will be loaded into
the first CBinaryFile:Length bytes of the memory buffer to which
CBinaryFile::Record points. If UserAccess is 'R' or 'W' (write), the file
will be closed after the I/O operation, and the CBinaryFile::Close() member
function should not be called. If UserAccess is 'B', this member
function will leave the file open and locked, and the CBinaryFile:Close() member
function must be called to rewrite the contents of the memory buffer back
into the file. If UserAccess is 'W', CBinaryFile::Record and
CBinaryFile::Length must be initialized by the constructor or by the
inherited function before this function is called, and this function
opens the file for output, overwriting any existing data, writes the contents of
the memory buffer specified by CBinaryFile::Record for the length specified in
CBinaryFile::Length into the opened file, and closes the file. If this
member function is successful, it returns TRUE. Otherwise, it returns
FALSE.
- void CBinaryFile::Close()
- If the UserAccess specified in the CBinaryFile::Open() member function is
'R' or 'W', this member function does nothing. If the UserAccess specified
in the CBinaryFile::Open() member function is 'B', this member function writes
the contents of the memory buffer specified by CBinaryFile::Record for the
length specified in CBinaryFile::Length into the opened file overwriting the
existing data, and closes the file.
- char* CBinaryFile::Record
- This data member is used to store the pointer to the memory buffer that
contains a copy of the binary file. It may be set by the constructor or
directly by the inherited function.
- int CBinaryFile::Length
- This data member is used to store the length of the memory buffer that
contains a copy of the binary file. It may be set by the constructor or
directly by the inherited function.
- BOOL CBinaryFile::FileClose
BOOL CBinaryFile::FileRead
- These data members maintain the status of the binary file. If the file
is opened or closed directly by the inherited class, these data members should
be adjusted as well.
[ TCommandLineInfo
| CCommaFile
| CDataFile
| TDateCtrl
| CDDE
| CDdeClient
| CDdeServer
]
[ CDirectoryLocator
| CDirectoryDialog
| CDirectoryFind
| CDirectoryNew
| CFileCopy
| TFrameWnd
]
[ InterfaceExcel
| CMaintFn
| CPrintFile
| CProcDialog
| TPrintDialog
| CProcPropertyPage
]
[ CProgress
| CRegistry
| CSDisCreate
| CSDisFile
| CSDisPage
| CSDisView
| CTableFile
]
[ CTaskIcon
| TPresent
| TTime
| TDate
| TDateTime
| CTransferData
| TWinApp
| CXlTable
]
[ Stand-alone Programs
| Standard Library
| Conversion Functions
| Utility Functions
| COBOL Functions
]
[ Windows NT Library
| COBOL Library
| COBOL Interface
| Command Prompt Abbreviations
| Purchase Instructions
]
[ Home
| Areas of Expertise
| "We Do Windows"
| Clients and Projects
| Software Samples
| Package Software Available
]
[ Contact Information
| Business Software Philosophy
| Church Software Philosophy
]
All contents of this web site are Copyright © Titus Information Systems,
Inc., Phoenix, Arizona, U.S.A.