L_NITFGetNITFHeader

#include "ltntf.h"

L_LTNTF_API L_INT L_NITFGetNITFHeader(hNitf, pNITFHeader)

HNITF hNitf;

handle to an existing NITF file

pNITFHEADER pNITFHeader;

pointer to a NITFHEADER structure

Retrieves the NITF file header information.

Parameter

Description

hNitf

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

pNITFHeader

Pointer to a NITFHEADER structure to be updated with the NITF file header information.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To change the NITF file header information, call the L_NITFSetNITFHeader 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_NITFSetNITFHeader

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 NITFGetNITFHeaderExample(L_VOID) 
{ 
   HNITF hNitf; 
   L_UINT uFlags = 0; 
   NITFHEADER NITFHeader; 
   L_INT nRet; 
   memset(&NITFHeader, 0, sizeof(NITFHeader)); 
   // 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 NITF file header 
   nRet = L_NITFGetNITFHeader(hNitf, &NITFHeader) ; 
   if(nRet == SUCCESS) 
   { 
      L_CHAR szTitle[] = "LEAD Technologies, Inc"; 
      strncpy_s(NITFHeader.pFTITLE, strlen(NITFHeader.pFTITLE), szTitle, strlen(szTitle)); 
      nRet =L_NITFSetNITFHeader(hNitf, &NITFHeader); 
      if(nRet !=SUCCESS) 
         return nRet; 
      L_NITFFreeNITFHeader(&NITFHeader); 
   } 
   else 
      return nRet; 
   nRet =L_NITFDestroy(&hNitf); 
   if(nRet !=SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 

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