LBaseFile::RedirectOpenCallBack

Summary

Replaces the normal LEADTOOLS function for opening a file.

Syntax

#include "ltwrappr.h"

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

Parameters

L_TCHAR * pFile

Character string containing the name of the file to load.

L_INT 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.

L_INT 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

Value Meaning
>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:

Note: The Redirect input / output functions do not support Kodak PhotoCD (PCD) or FlashPix (FPX) files.

Required DLLs and Libraries

See Also

Functions

Topics

Example

For an example, refer to LFile::StartFeedLoad.

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.