LEADTOOLS Raster Imaging C DLL Help > Function References > L_FileInfo |
#include "l_bitmap.h"
L_LTFIL_API L_INT L_FileInfo(pszFile, pFileInfo, uStructSize, uFlags, pLoadOptions)
L_TCHAR* pszFile; |
/* input file name to query */ |
pFILEINFO pFileInfo; |
/* pointer to the FILEINFOFILEINFO structure to be filled */ |
L_UINT uStructSize; |
/* size in bytes, of the structure pointed to by pFileInfo */ |
L_UINT uFlags; |
/* flag */ |
pLOADFILEOPTION pLoadOptions; |
/* pointer to optional extended load options */ |
Gets information about the specified file and fills the specified FILEINFO structure with the information.
Parameter |
Description |
|
pszFile |
Character string containing the input file name to query. |
|
pFileInfo |
Pointer to the FILEINFO structure to be filled. For more information, see FILEINFO structure. |
|
uStructSize |
Size in bytes, of the structure pointed to by pFileInfo, for versioning. Use sizeof(FILEINFO). |
|
uFlags |
Flag indicating whether to update the TotalPages field in the FILEINFO structure. Possible values are: |
|
|
Value |
Meaning |
|
FILEINFO_TOTALPAGES |
[0x0001] Update the pFileInfo->TotalPages field with the total number of pages in the file. |
|
0 |
Do not update the pFileInfo->TotalPages field. |
pLoadOptions |
Pointer to optional extended load options. Pass NULL to use the default load options. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
To use this function, do the following:
1. |
Declare a variable with the datatype of FILEINFO. |
2. |
Declare and assign a character string variable for the file name. |
3. |
If you are getting information about a multi-page file (which can contain more than one image), use the LOADFILEOPTION structure to specify the page number. The information that you get will be for the image on the specified page. |
4. |
Initialize the FILEINFO structure to zero values. |
5. |
Call the L_FileInfo function, passing the file name, the address of the FILEINFO variable and the size of the FILEINFO structure as parameters. |
6. |
Get the image information from the fields described in FILEINFO structure. |
For a summary of file information functions, refer to Getting and Setting File Information.
Note: More options are available in the LOADFILEOPTION structure.
Note: For information about loading and saving large TIFF files faster, refer to Loading and Saving Large TIFF Files.
Note: You should never pass an uninitialized FILEINFO structure to this function.
Required DLLs and Libraries
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Win32, x64, Linux.
See Also
For a list of functions that utilize the LOADFILEOPTION or SAVEFILEOPTION structures, refer to Functions Utilizing the LOADFILEOPTION or SAVEFILEOPTION structures.
Example
For complete sample code, refer to the INFO example. This example gets file information and displays it in a message box.
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName L_INT FileInfoExample(L_VOID) { L_INT nRet; FILEINFO FileInfo; /* LEAD File Information structure. */ L_TCHAR szMessage[1024]; /* Buffer to hold information for display. */ /* Get the file information */ memset(&FileInfo, 0, sizeof(FILEINFO)); FileInfo.uStructSize = sizeof(FileInfo); // for fast file info only, use the following: L_EnableFastFileInfo(TRUE); nRet = L_FileInfo(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &FileInfo, sizeof(FILEINFO), 0, NULL); if(nRet != SUCCESS) return nRet; /* Format the message string with data from the FILEINFO structure */ wsprintf(szMessage, TEXT("Filename: %s\n\n") TEXT("Format: %d\n\n") TEXT("Width: %d\n\n") TEXT("Height: %d\n\n") TEXT("BitsPerPixel: %d\n\n") TEXT("Size On Disk: %ld\n\n") TEXT("Size In Memory: %ld\n\n") TEXT("Compression: %s"), (L_TCHAR *) FileInfo.Name, FileInfo.Format, FileInfo.Width, FileInfo.Height, FileInfo.BitsPerPixel, FileInfo.SizeDisk, FileInfo.SizeMem, (L_TCHAR *) FileInfo.Compression ); /* Display the message string */ MessageBox( NULL, szMessage, TEXT("File Information"), MB_OK ); return SUCCESS; }