LBaseFile::RedirectOpenCallBack

#include "ltwrappr.h"

virtual L_INT LBaseFile::RedirectOpenCallBack(pFile, nMode, nShare)

L_CHAR L_FAR * pFile;

/* name of the file to load */

L_INT nMode;

/* access mode */

L_INT nShare;

/* share mode */

Replaces the normal LEADTOOLS function for opening a file.

Parameter

Description

pFile

Character string containing the name of the file to load.

nMode

The access mode for the file. Possible values are:

 

Value

Meaning

 

O_APPEND

[0x0008] Repositions the file pointer to the end of the file before every write operation.

 

O_BINARY

[0x8000] Opens file in binary mode.

 

O_CREAT

[0x0100] Creates and opens a new file for writing; this has no effect if the file exists.

 

O_EXCL

[0x0400] Returns an error if the file name exists. Only applies when used with O_CREAT.

 

O_RDONLY

[0x0000] Opens file for reading only; if this flag is given, neither O_RDWR nor O_WRONLY can be given.

 

O_RDWR

[0x0002] Open file for both reading and writing; if this flag is given, neither O_RDONLY nor O_WRONLY can be given.

 

O_TEXT

[0x4000] Open file in text mode.

 

O_TRUNC

[0x0200] Opens and truncates an existing file to zero length. The contents of the file are destroyed. If this flag is given, you cannot specify O_RDONLY.

 

O_WRONLY

[0x0001] Opens file for writing only; if this flag is given, neither O_RDONLY nor O_RDWR can be given.

 

LEADTOOLS assumes you will open the file as binary unless the nMode value specifically indicates otherwise. If you use a function that does not open the file as binary by default (ex. _topen) then you should be sure to open the file as binary.

nShare

The share mode for the file. Possible values are:

 

Value

Meaning

 

S_IREAD

[0000400] Opens the file and denies other programs read access to the file. If the file has been opened for read access by any other program, the callback should return an error.

 

S_IWRITE

[0000200] Opens the file and denies other programs write access to the file. If the file has been opened for write access by any other program, the callback should return an error.

Returns

>0

File handle to be used with other I/O functions.

-1

An error occurred.

Comments

Override this function to replace the normal LEADTOOLS function for opening a file.

The Redirect input / output functions cannot be used in combination with LFile::FeedLoad, LFile::StartFeedLoad, LFile::StopFeedLoad, LMemoryFile::LoadBitmap, LMemoryFile::LoadMemory, and LMemoryFile::SaveBitmap.

Note:

The Redirect input / output functions do not support Kodak PhotoCD (PCD), FlashPix (FPX), or Microsoft FAX (AWD) files.

Required DLLs and Libraries

LTKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

Class Members

Topics:

Raster Image Functions: Input and Output

 

Annotation Functions: Input and Output

Example

For an example, refer to LFile::StartFeedLoad.