Another type of file I/O?

This is a discussion on Another type of file I/O? within the C++ Programming forums, part of the General Programming Boards category; Is there a way to make a non readable/non editable file using C++ or is there an easier way of ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    4

    Another type of file I/O?

    Is there a way to make a non readable/non editable file using C++ or is there an easier way of saving data for my game?

  2. #2
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    well you could try encrypting the file or somthing like that.

  3. #3
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    You can change the attributes of a file to make it Read Only - not sure how you would do that in straight C++, however. Beware that there are ways around this. If someone wants to tamper with a file there's probably a way to do it, the only thing up to you is how difficult it is - do your job well enough and not too many people will bother.

    Rune Hunter also makes a good suggestion. Some ideas would be to add checks that would tip your program off that someone had been tampering with it. ASCII files are easily readable and changeable, but binary files are harder for humans to work with outside of a program designed just to read them. They have some drawbacks, like OS inconsistencies, but look into it.

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Lightbulb Look into "exclusive-or" encryption.

    Exclusive-or encryption (aka XOR encryption) is the simplest way to make your file "unreadable". It uses bitwise exclusive-or to scramble the data.

    The beauty of XOR encryption is that it uses the same simple algorithm to encrypt and decrypt. The downside is that it can be easy to crack if you use a simple (i.e. 1-character) key. I believe it is used more often as an introduction to bitwise operations than real encryption. However, it will scramble the file so that it's not readable without decrypting.
    Last edited by DougDbug; 10-19-2004 at 08:29 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  2. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 02:19 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  4. Erros in Utility Header File
    By silk.odyssey in forum C++ Programming
    Replies: 4
    Last Post: 12-22-2003, 06:17 AM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21