Jump to content

  • Log In with Google      Sign In   
  • Create Account

Pointers To Appendage Of File?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Toothpix   Crossbones+   -  Reputation: 810

Like
0Likes
Like

Posted 19 February 2013 - 07:33 PM

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, 19 February 2013 - 07:34 PM.

C dominates the world of linear procedural computing, which won't advance. The future lies in MASSIVE parallelism.


Sponsor:

#2 ultramailman   Prime Members   -  Reputation: 1585

Like
2Likes
Like

Posted 19 February 2013 - 11:34 PM

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?



#3 King Mir   Members   -  Reputation: 2050

Like
2Likes
Like

Posted 20 February 2013 - 01:10 AM

EDIT:Yeah in C, fseek is the way to go.



#4 demonkoryu   Members   -  Reputation: 976

Like
1Likes
Like

Posted 20 February 2013 - 03:41 AM

Look into memory mapped files.



#5 Nik02   Crossbones+   -  Reputation: 2917

Like
1Likes
Like

Posted 20 February 2013 - 04:40 AM

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, 20 February 2013 - 04:47 AM.

Niko Suni


#6 Toothpix   Crossbones+   -  Reputation: 810

Like
0Likes
Like

Posted 20 February 2013 - 05:18 AM

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.


C dominates the world of linear procedural computing, which won't advance. The future lies in MASSIVE parallelism.


#7 Nik02   Crossbones+   -  Reputation: 2917

Like
1Likes
Like

Posted 20 February 2013 - 05:33 AM

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, 20 February 2013 - 05:34 AM.

Niko Suni





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS