CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2017
    Posts
    2

    Question Creating protected files filled with data

    Hello, I am making a game and I want to store highscores inside a file.
    How do I make this data protected so no one could edit anything.

    For now, I encrypted the score and put it into file and when loading it I can decrypt it. All these encrypted strings are inside file "scores.txt".

    Is it possible to create a file with custom extension that no one could open ?


  2. #2
    Join Date
    Mar 2017
    Posts
    2

    Creating custom file extensions

    Hello,
    I made a game and I store my scores in text file, but before that I encrypt them... later I can decrypt them.

    How can I create a custom file that no one will be able to open it except for me ?


    e.g File "scores.myext" that will contain my scores.

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Creating protected files filled with data

    [merge threads...]
    Victor Nijegorodov

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Creating protected files filled with data

    Any reason not to use the registry?

  5. #5
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Creating protected files filled with data

    How can I create a custom file that no one will be able to open it except for me
    The computer administrator account can always obtain sufficient privileges and permissions to be able to open and read (and modify) the content of any file on the system. However, there are what is called alternate data streams that can be associated with a file, the contents of which don't show if you just use the normal ways to view a file. These alternate data streams of a file are given names and you need to know both the file name and the stream name to be able to access this alternate data. There are only a few standard programs that work properly with these alternate streams. See https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  6. #6
    Join Date
    Jan 2009
    Posts
    399

    Re: Creating protected files filled with data

    Just serialize your data in a file with custom extension, and only your application could de-serialize your data ... there is a lot of examples on internet that show you how to serialize integers, strings, etc.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured