LNITFFile::GetTextSegment

Summary

Retrieves a buffer for the text data at a specified index in the text segment.

Syntax

#include "ltwrappr.h"

L_INT LNITFFile::GetTextSegment(uIndex, pLBuffer)

Parameters

L_UINT uIndex

A zero-based index of the text data in the text segment.

LBuffer * pLBuffer

Pointer to LBuffer object to be updated with the text data.

Returns

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

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT LNITFFile_GetTextSegmentExample() 
{ 
   //Parse the NITF file 
   LNITFFile Nitf;  
 
   Nitf.Create (MAKE_IMAGE_PATH(TEXT("test.ntf"))); 
 
   L_UINT uFlags = 0;  
   TXTHEADER TextHeader;  
   L_UINT uCount;  
   L_UINT i = 0;  
 
   memset(&TextHeader, 0, sizeof(TXTHEADER));  
 
   // Check if the NITF is empty or invalid 
   uFlags = Nitf.GetStatus (); 
   if((uFlags & NITF_FILE_EMPTY) == NITF_FILE_EMPTY)  
   { 
      MessageBox(NULL, TEXT("NITF file is empty"), 0, 0); 
      return SUCCESS; 
   } 
 
   if((uFlags & NITF_FILE_VALID) != NITF_FILE_VALID)  
   { 
      MessageBox(NULL, TEXT("NITF file is invalid"), 0, 0); 
      return SUCCESS; 
   } 
 
   // Update the Text header 
   uCount = Nitf.GetTextHeaderCount (); 
   for( i = 0; i < uCount; ++i)  
   { 
      LBuffer Buffer; 
      Nitf.GetTextSegment(i, &Buffer); 
 
      MessageBoxA(NULL, (LPCSTR)Buffer.Lock(), "Text Segment", 0); 
      Buffer.Unlock(); 
   } 
 
   Nitf.SaveFile (MAKE_IMAGE_PATH(TEXT("test1.ntf"))); 
 
   Nitf.Destroy (); 
 
   return SUCCESS; 
} 
Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

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