• Advertisement
Sign in to follow this  

Creating a Filetype?

This topic is 2298 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

I'm getting close to needing the ability to export and import specific files to contain level information in my game. But I'm not quite sure on how to proceed. I'm using boost to manage finding the files, but I'm not sure on the specifics of how to work with this.

Basically, how would one open a file, read information, and change information? Also, do I need to create a new filetype or can I use an existing one?

I hope this made sense and as always all replies and help are appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Well, since you are already using boost, there is a boost::filesystem component that might point you in the right direction, or you could use cstdio (or stdio.h if you are writing this in C).

As for the filetype, start w/ the information you would like to save, see if there is already a file format that would suit your purposes (make sure it is alright to use it, of course) and if there isn't, well, you can always RYO. :)

Share this post


Link to post
Share on other sites

Well, since you are already using boost, there is a boost::filesystem component that might point you in the right direction, or you could use cstdio (or stdio.h if you are writing this in C).

As for the filetype, start w/ the information you would like to save, see if there is already a file format that would suit your purposes (make sure it is alright to use it, of course) and if there isn't, well, you can always RYO. :)


Thanks for the reply.

What component would that be? And this engine is being built entirely by me so I dunno if there's a filetype that could support it, so that's why I'm asking.

By the way, what's RYO? =P

Share this post


Link to post
Share on other sites
RYO = Roll your own. In other words, made by you :)

The component I saw was boost::FileSystem. Not totally sure if it is already a part of boost, or if it needs to be d/l'ed separately.

Share this post


Link to post
Share on other sites

RYO = Roll your own. In other words, made by you :)

The component I saw was boost::FileSystem. Not totally sure if it is already a part of boost, or if it needs to be d/l'ed separately.


Yeah I'm using boost::filesystem to search directories for files and such. I figured I'd probably have to make my own filetype or some such, but I don't really know how to do that. Can you point me to some references to achieve this?

Share this post


Link to post
Share on other sites
The concept of "file type" is a distinct notion from how your program deals with what's actually in the file. Any basic tutorial on file I/O (input/output) can get you started on reading and writing files. There is no need to mess with "file types" to just read and write data.

Share this post


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

  • Advertisement