Jump to content
  • Advertisement
Sign in to follow this  
MrJoshL

Pointers To Appendage Of File?

This topic is 2006 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a way to point to a certain part of a very large file (>1 gigabyte)?

 

My intention is to store every game asset in a database. My way of doing that is just to write a file that may be a little bit bigger than a gigabyte, but still holding everything like a database. Is there a way to quickly point to a certain entry in the database, rather than doing a search every time I need to pull something?

 

EDIT: I do know that there is a WinAPI function for file pointers than can be changed to an offset of 5 bytes, but is there an easier way, preferably with the standard library?

Edited by MrJoshL

Share this post


Link to post
Share on other sites
Advertisement

fseek can be used to set the position of an open file stream, but it is only portable if your file is read and written in binary mode.

 

Is this what you mean?

Share this post


Link to post
Share on other sites

Windows file cursors are internally 64-bit, so it is easy to access more than 1 gb. On 32-bit systems, you cannot directly map more than 4gb into your process address space - of course - because the pointers are 32-bit. You can still seek, read and write normally, though. It is also possible to map different regions of the file, if it is larger than the available address space.

Edited by Nik02

Share this post


Link to post
Share on other sites

Thank you. I will use fseek, and yes, it it is a binary file database. The one gigabyte size wasn't imposed as a limit, I just only have 1 gigabyte of content to pack.

Share this post


Link to post
Share on other sites

That's a very reasonable size for a commercial, locally-installable game. Most recent games on the market are way larger due to content size. Of course, for web-based gaming and/or distribution, smaller is usually better.

Edited by Nik02

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!