#include "ltntf.h"
L_LTNTF_API L_INT L_NITFGetNITFHeader(hNitf, pNITFHeader)
Retrieves the NITF file header information.
Handle to an existing NITF file, created by calling the L_NITFCreate function.
Pointer to a NITFHEADER structure to be updated with the NITF file header information.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
To change the NITF file header information, call the L_NITFSetNITFHeader function.
Required DLLs and Libraries
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;
}