L_NITFGetTextHeader

#include "ltntf.h"

L_LTNTF_API L_INT L_NITFGetTextHeader(hNitf, uIndex, pTxtHeader)

HNITF hNitf;

handle to an existing NITF file

L_UINT uIndex;

index of the text segment

pTXTHEADER pTxtHeader;

pointer to a TXTHEADER structure

Retrieves the text header information of a specific text segment.

Parameter

Description

hNitf

Handle to an existing NITF file, created by calling the L_NITFCreate function.

uIndex

A zero-based index of the text segment in the hNitf handle.

pTxtHeader

Pointer to a TXTHEADER structure to be updated with the text header information of the specified text segment at the index uIndex.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To retrieve the number of the text segments available in the hNitf handle, call the L_NITFGetTextHeaderCount function.

To change the text header information for a specific text segment, call the L_NITFSetTextHeader function.

Required DLLs and Libraries

LTNTF

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:

L_NITFCreate, L_NITFGetTextHeaderCount, L_NITFSetTextHeader

Topics:

NITF Functions: Getting and Setting Header Information

 

Programming with LEADTOOLS NITF Functions

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT NITFGetTextHeaderExample(L_VOID) 
{ 
   L_INT nRet = SUCCESS; 
   HNITF hNitf; 
   L_UINT uFlags = 0; 
   TXTHEADER TextHeader; 
   L_UINT uCount; 
   L_UINT i = 0; 
   memset(&TextHeader, 0, sizeof(TXTHEADER)); 
   //Create hNitf Handle and Parse the NITF File 
   nRet =L_NITFCreate (&hNitf, MAKE_IMAGE_PATH(TEXT("test.ntf"))); 
   if(nRet !=SUCCESS) 
      return nRet; 
   //Check if the hNITF is Empty or Invalid 
   uFlags = L_NITFGetStatus(hNitf); 
   if((uFlags & NITF_FILE_EMPTY) == NITF_FILE_EMPTY) 
   { 
      MessageBox(NULL,TEXT("NITF File is Empty"),NULL,MB_OK); 
      return FAILURE; 
   } 
   if((uFlags & NITF_FILE_VALID) != NITF_FILE_VALID) 
   { 
      MessageBox(NULL,TEXT("NITF File is Invalid"),NULL,MB_OK); 
      return FAILURE; 
   } 
   // Update the Text Header 
   uCount = L_NITFGetTextHeaderCount(hNitf); 
   for( i = 0; i < uCount; ++i) 
   { 
      memset(&TextHeader, 0, sizeof(TextHeader)); 
      nRet = L_NITFGetTextHeader(hNitf, i, &TextHeader); 
      if(nRet == SUCCESS) 
      { 
         L_CHAR szTitle[] = "LEAD Technologies, Inc"; 
         strncpy_s(TextHeader.pTXTITL, strlen(TextHeader.pTXTITL), szTitle, strlen(szTitle)); 
         nRet =L_NITFSetTextHeader(hNitf, i, &TextHeader); 
         if(nRet !=SUCCESS) 
            return nRet; 
         L_NITFFreeTextHeader(&TextHeader); 
      } 
      else 
         return nRet; 
   } 
   nRet =L_NITFSaveFile(hNitf,MAKE_IMAGE_PATH(TEXT("test2.ntf"))); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =L_NITFDestroy(&hNitf); 
   if(nRet !=SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS NITF C API Help