I'm working on a C application which is running on HP-Nonstop and it needs to get the size of files on disk. The already implemented way of doing that is the following:
char *filename;
short itemlist;
long fileLength = 0;
short retCode;
itemlist = 142; /* file size */
retCode = FILE_GETINFOLISTBYNAME_( filename,
(short)strlen(filename),
&itemlist,
1,
(short*)&fileLength,
sizeof(fileLength) );
As I read in the documentation this only works for files of size not greater than about 2GB:
If the file being referenced is an [...] OSS files larger than approximately 2 gigabytes, item codes will return -1 with no error indication.
Thus my questions:
- How can I obtain the size of files bigger than 2GB?
- Is there a way to have a look into how
FILE_GETINFOLISTBYNAME_
is implemented? Maybe one could write their own implementation for large files.
Not sure why option 142 does not return the size for 2 GB file even though it uses unsigned 32 bit variable to return the size.
You can use option 191 which would return the size in 64 bit variable.
Here is documentation for option 142 which is recommending to use option 191 for larger file size.