Creating a Filetype?

Started by
4 comments, last by ApochPiQ 12 years, 5 months ago
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.
Prove me wrong so I can know what's right.
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. :)

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
Prove me wrong so I can know what's right.
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.

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?
Prove me wrong so I can know what's right.
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.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

This topic is closed to new replies.

Advertisement