hi,
i wanted to knoe that how to calculate the total size of file in C?
khot_anuradha 0 Newbie Poster
Recommended Answers
Jump to Post>open the file, seek to end, the get current file position
That's only guaranteed to be meaningful on files opened with a binary orientation. Even then there's a possibility that the size may be inaccurate. The only portable way to determine the working size of a file is to open …
Jump to Post>use of standard library file i/o functions are guarenteed by the
>language to be portable across platforms that support them.
And conveniently enough the standard clearly states that arbitrary seeking on a text file is undefined.>reading the file from beginning to end in MS-Windows will result
>in incorrect …
Jump to PostFWIW -
opening an MS-DOS text file (FAT16) in binary mode doesn't necessarily work as described above. The reason is that the reported size of the file by the filesystem is not the same as the length of the data in the file - because text files in MS-DOS …
Jump to PostUNIX does - and you can create files with "holes" in them - literally.
In other words, a block (say 512 bytes) then a hole which uses ~twenty bytes but actually is say ten blocks of ASCII nul, then another block of data.When this file is created it …
All 13 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Narue 5,707 Bad Cop Team Colleague
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Narue 5,707 Bad Cop Team Colleague
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Narue 5,707 Bad Cop Team Colleague
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Narue 5,707 Bad Cop Team Colleague
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
jim mcnamara 19 Junior Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
jim mcnamara 19 Junior Poster
agiorgio 0 Newbie Poster
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.