file size stored inside file?

Programming related discussions related to game research
garan
Posts: 4
Joined: Thu Mar 10, 2022 1:10 pm

file size stored inside file?

Post by garan »

how come lots of file formats include the size of the file inside the file? why not just seek to the end and ftell()? it seems like a waste of bytes
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: file size stored inside file?

Post by rabatini »

garan wrote:how come lots of file formats include the size of the file inside the file? why not just seek to the end and ftell()? it seems like a waste of bytes

Because games works with TOC/LBA.
it cannot just seektoend because the game works with many files with in loadeded into ram and need pointers because its not an individual file.
So generally have a table pointing the files begin and end.
or some kind of math to do the same job.

I strongly suggest you read some document of asmromhacking.
Because its seems you are very newbie in this subject.