|
Object Creation and Initialization
|
|
|
To perform file input/output with IXFile you must first create object, then unlock its functionality by setting valid license key,
and finally initialize it to appropriate mode of operation depending on your needs. All IXFile activities must start with these three
operations performed in given order as shown below:
| |
|
1.
|
CREATE OBJECT
|
|
2.
|
LICENSE OBJECT
|
|
3.
|
INITIALIZE OBJECT
|
| |
Creating Object
Uninitialized object is created with Constructor that also enables Unicode system calls
on NT/2000/XP platforms and sets ANSI codepage as a default codepage for ANSI/Unicode conversion; see Unicode Support for more information.
When no longer needed, object should be destroyed (either automatically or manually) to release resources.
Licensing Object
License key is set with SetLicenseKey method. You can specify any valid license key either permanent or trial (time-limited).
License key is checked in most of IXFile methods; if it is recognized as invalid or expired methods fail.
See License Keys for more information on license keys.
Initializing Object
Object is initialized with Initialize method that sets mode of operation of the object and allocates data buffers.
Correct initialization is crucial because it determines lifetime behaviour of the object which cannot be changed dynamically.
Mode of operation specifies type of access to the object (read, write or both), enables automatic file locking (for reading, writing or both), automatic file closing and specifies byte order
of file data (little- or big-endian). During initialization, file data buffer of specified size is also allocated. Method has default parameters (read and write access, automatic file closing, 16KB buffer)
that allows simplified initialization for quick start. Initialization parameters can be later examined with GetMode and GetBufferSize methods.
Examples
C++
int main(int, char**)
{
IFile ixf1;
IFile *ixf2;
ixf2 = new IFile();
ixf1.SetLicenseKey("YOURLICENSEKEY");
ixf2->SetLicenseKey("YOURLICENCEKEY");
ixf1.Initialize();
ixf2->Initialize(IXF_MODE_READ | IXF_MODE_READLOCK, 1024);
ixf1.Open("test1.bin");
ixf2->Open("test2.bin");
.
.
.
ixf2->Close();
delete ixf2;
return(0);
}
BASIC
Sub Main()
Dim ixf1 As IXFile, ixf2 As IXFile
Set ixf1 = New IXFile
Set ixf2 = New IXFile
ixf1.SetLicenseKey "YOURLICENSEKEY"
ixf2.SetLicenseKey "YOURLICENSEKEY"
ixf1.Initialize
ixf2.Initialize IXF_MODE_READ Or IXF_MODE_READLOCK, 1024
ixf1.Open "test1.bin"
ixf2.Open "test2.bin"
.
.
.
ixf2.Close
End Sub
See Also
Constructor,
SetLicenseKey,
Initialize,
GetMode,
GetBufferSize