• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

how to use fsetpos and fgetpos correctly

Onceler

Golden Member
I am trying to write a simple program in Code::Blocks GNU GCC in Windows 7 64 bit that will allow my program to determine the maximum number of bytes in a very large file say like 31 gigabytes and report that back.
So far what I have found through google is just prototypes which do not have any real world examples.
Can someone point me in the right direction or if I should be using fgetpos and fsetpos in the first place? Is there an easier way?
 
I'm not sure I understand what you're trying to do. You can read the size of the file to the byte from the file system. On Win32 the api is FindFirstFile and FindNextFile. If you want a cross-platform solution try boost filesystem.
 
Then you'll probably have to use platform specific APIs like FindFirstFile that was already mentioned.
 
The most compelling reason not to use OOP is that the filesizes tend to stay smaller and more readable.

Are you talking about the source code? If so, that's the most inane reasons I've heard of for avoiding C++.

I can understand not wanting to learn a new language(it's not necessarily easy), but as a programmer learning a new language should be part of your skill set.
 
no I am talking about the executables they don't run as fast as good old fashioned low level C
plus they are bigger
 
no I am talking about the executables they don't run as fast as good old fashioned low level C
plus they are bigger

Well that's even more ridiculous, unless you happen to running on some embedded system with severely limited resources.
 
no I am talking about the executables they don't run as fast as good old fashioned low level C
plus they are bigger

And you're writing what type of application where the tiny difference in speed and executable size makes a difference....?
 
Look I just want to code in C, I don't want to use C++
it is a matter of preference maybe I will learn C++ eventually but for now I think I should stick to C
I had a programing class on C++ and that OOP really turned a knot in my gut.
I want to do the most basic things and worry about the higher level stuff later.
 
Last edited:
Look I just want to code in C, I don't want to use C++
it is a matter of preference maybe I will learn C++ eventually but for now I think I should stick to C
I had a programing class on C++ and that OOP really turned a knot in my gut.
I want to do the most basic things and worry about the higher level stuff later.

I think once you learn it you'll find that OOP is significantly easy to use for projects with any real complexity than procedural programming.

But whatever. I think the root of the issue is that no one has even suggested any OOP solutions that I've seen. FindFirstFile is a C function and does not use OOP in any way.
 
I do plan on learning C++ eventually but right now I just want to learn C so I can be experienced without skipping over important concepts
 
Back
Top