Discuss Getting a Files Size in the C Programming forum on Dev Shed. Getting a Files Size C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
Posts: 145
Time spent in forums: 1 Day 14 h 48 m 55 sec
Reputation Power: 9
Getting a Files Size
Does anyone know of a simple cross-platform way of getting the size of a file? I have had a look but can not seem to find much.
Thanks for all of your help.
Posts: 145
Time spent in forums: 1 Day 14 h 48 m 55 sec
Reputation Power: 9
It seems to work quite well, however ftell returns either an int or a long. However, the size of the files which I am working with is often over 4Gb and so it needs to return either an unsigned long or even better a long long, is there such a thing as ftell64?
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,390
Time spent in forums: 1 Month 4 Weeks 1 Day 22 h 32 m 40 sec
Reputation Power: 4080
Nope. When you're dealing with files of that size, you need to go to an OS specific function.
__________________ Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
Posts: 145
Time spent in forums: 1 Day 14 h 48 m 55 sec
Reputation Power: 9
The code project did a good article on how to use the 64 bit version of the functions for VC++, (http://www.codeproject.com/file/64-bit_fileio.asp) but does anyone know the 'GNU' versions of these functions (or the best way to do it on these operating systems).
Does anyone know if there are any plans to update the stdio functions with 64-bit versions, as it is something that people need and I myself like to keep my code clean and free from as much OS-specific code as possible.