Sign in to follow this  

How to create your own filetype and pack files in it? C++

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

First off, I am fairly new to c++ programming. I was just wondering how one goes about creating their own file types, and then packing other files inside of the file you created. Some examples would be the allegro grabber tool, or doom wad files. I would like to in the future protect the art/config files/level data that my games use. Is this hard to do? How do you protect a file you made so any random person can't open it? I'm not worried about compressing, so don't get into that unless you really want to.

Share this post


Link to post
Share on other sites
Quote:
Original post by gapern
First off, I am fairly new to c++ programming. I was just wondering how one goes about creating their own file types, and then packing other files inside of the file you created.

With the file stream classes. You can open a new file in binary mode, and then write arbitrary data to it. Later, you can read the file in binary mode, and follow the same procedure that you used to create the file, except with reads instead of writes.

Quote:
ow do you protect a file you made so any random person can't open it? I'm not worried about compressing, so don't get into that unless you really want to.

You can't. You can only make it difficult for them. You can make it difficult by using your own custom file formats instead of standard ones, or by using complicated encoding schemes (encryption, compression, etc...).

Share this post


Link to post
Share on other sites
This topic comes up quite often here. In fact, there's a thread on the subject going right now in For Beginners. I'd start by reading that thread, and then maybe search the forum archives using some appropriate search terms and see what comes up (there have been a lot of threads on this topic, so you should get some hits).

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
This topic comes up quite often here. In fact, there's a thread on the subject going right now in For Beginners. I'd start by reading that thread, and then maybe search the forum archives using some appropriate search terms and see what comes up (there have been a lot of threads on this topic, so you should get some hits).



Are you serious? I'm sorry. I really should have searched first. I was looking on google and could not find any results, but I did not search the actual gamedev site. I'll search the forums then. Thank you.

Share this post


Link to post
Share on other sites

This topic is 3595 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this