File I/O

Hey guys I'm pretty much a newbie, I recently started learning C++ and right now am at the very first block, just learning about the basics.

I came across a chapter in a tutorial I'm looking at and I'm up to File I/O. I've seen very briefly how this works. (it wrote some text to a .txt file onto my desktop).

I do have a question, is it possible to store a zip file in a program and say to release that file (onto the desktop) you have to input a password to do so?



p.s if this post is in the wrong section I apologise I'm new here. ^_^
You'd have to use a library that supports zipping and unzipping compressed zipped folders with passwords on files, etc. You could do it with file streams yourself manually, but you'd need to know about compression, the zip file format, etc, and it's all be insanely over complicated. It's best to find a library that does it all for you and use it, though you may not be at the stage in programming where you can easily adapt to using a library, so I suggest you wait until you're more familiar with the C++ language first.
Wotcher!

This is the right section. Don't worry. :)

Yes, there is a way to do that. You could theoretically embed a file in your program and require a password for it to be written. If the file is large, though, you might be better off just doing encryption/decryption, which you should do anyway since anyone skilled enough with a hex editor could yank the file right out of your executable and read it without any hassle. ;)

Happy coding.

-Albatross

Ok good to know it's possible, thanks!

@ L B yeah I wont confuse myself too much at this stage and stick with the basics, but it's definately a goal to work forward to.
Last edited on
Topic archived. No new replies allowed.