I get very large binary print files that need to be sent directly to the Windows spooler. If the file is less than 2GB, I get LOF (or FileLen) and divide that by a defined buffer size. A segment of the input file is read into the buffer and then a function is called to write the buffer to winspool.drv.

This works just fine until the input file exceeds 2GB - at that point, since both LOF and FileLen return LONG values, I can't get the filesize and don't know how many times to read into the buffer.

I guess the question is 'How do I get the filesize of a +2GB file?

Thanks -

Recommended Answers

All 2 Replies

The problem is worse than I thought . . . I use the fso model to get the size of the file then calculate the number of buffer read/write processes using a Get and Put sequence to insert the file into the Windows spooler. Trouble is that Get and Put us 'seek' as the middle argument as a marker of the next byte to read, and it is also a LONG value . . . ugh! Any suggestions?

DH again

sure, you can get the filesize, through unconventional means, OR you can get the file size in long value, and check if it's larger than 2GB, (just check the long value size), if it IS bigger than 2GB's, then generate 2 temp files, with 1/2 of the file in each (or more, if it's bigger than 4 gigs, or whatever). Then, in order of the temp files, read each one the standard way, and use the function on those. It seems like a bigger pain than is needed, but I'm sure it would work. I suppose another option, would be to read the file byte by byte, an d concantenate a variable, while keeping another variable to keep track of the size.... but that also seems like a bit of a pain.... let me know what you come up with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.