LAnnContainer::LoadOffset

#include "ltwrappr.h"

virtual L_INT LAnnContainer::LoadOffset(fd, nOffset, nLength, pLoadFileOption)

Loads annotations from a position within a file. This enables you to load an annotation file that is embedded in another file.

Parameters

L_HFILE fd

The Windows file handle of the file to load.

L_SSIZE_T nOffset

The position, from the beginning of the file, of the first byte to load. (The byte count starts at zero.)

L_SIZE_T nLength

The number of bytes of annotation data to read from the file. If you saved the offset using LAnnContainer::SaveOffset, the variable pointed to by puSizeWritten in that function contains the length of data saved. If you do not know the length of the data, pass 0xFFFFFFFF for this parameter.

pLOADFILEOPTION pLoadFileOption

Pointer to the LOADFILEOPTION structure to be updated with the current extended values.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LAnnContainer_LoadOffsetExample(LAnnContainer& LeadAContainer) 
{ 
   L_HANDLE OffsetFile; // File handle  
   L_SIZE_T ulSizeWritten; // Variable to be updated with the size written 
   L_INT nRet; 
   DWORD wWrittenBytes; 
    
   // Create a file ; 
    OffsetFile = CreateFile(MAKE_IMAGE_PATH(TEXT("TOFFSET.ANN")), GENERIC_ALL, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); 
    // Write header information -- 29 characters and a terminator  
    WriteFile(OffsetFile, "This is a 29-character string", 30,&wWrittenBytes,NULL); 
 
   // Save the file with an offset  
    ulSizeWritten = LeadAContainer.SaveOffset((L_HFILE)&OffsetFile, 30, ANNFMT_NATIVE, FALSE); 
 
   // Close the file  
   CloseHandle(OffsetFile); 
 
   /* Loading */ 
 
   if(ulSizeWritten>0) 
   { 
      // Open the file and get the file handle   
      OffsetFile = CreateFile(MAKE_IMAGE_PATH(TEXT("TOFFSET.ANN")), GENERIC_ALL, 0, NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 
      // Load the file with a 30-byte offset  
      nRet = LeadAContainer.LoadOffset((L_HFILE)OffsetFile, 30, ulSizeWritten, NULL); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      // Close the file  
      CloseHandle(OffsetFile); 
   } 
 
   return SUCCESS; 
} 
Help Version 21.0.2021.4.8
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help