.txt with C password?

Asked

Viewed 616 times

5

I’m dealing with file manipulation . txt and I wanted to know how to create a file . txt with a C password, so that this file cannot be opened by the notepad or other program without the password. And that later if I wanted to open the file I could use it in the C program using the password.

Encode the contents of . txt I already know how to do, like change its content to symbols and then recover, but what I want to do is make the file not "open" without the password.

  • Have a similar question on Soen. The suggestion was to compress to (.zip for example) and then lock with a password, might help ;)

  • 2

    I think all solutions go through encryption. It can be an encrypted file, an encrypted zip containing the file, a folder or an encrypted drive, etc.

  • Is there any way I can create a . Read-only TXT directly from Devc++? Maybe this will help me with what I want to do

  • @Divinsphere: I see no other way to do this reliably and effectively without the use of some cryptographic algorithm. By the way, what is your intention to do such a thing ? You already know the XY problem ?

  • I developed a questionnaire in C that can read Questions by Notepad, ie any lessoa can create questions and put in the program to answer, Type A Million Show with Questions nl Notepad, I made here a system to encode the notepad and I think I’ll have to settle anyway, we create questions in the notepad uses the program to encode and then just drag that the program decodes and starts the game

  • It is a game of questions and answers that any person could create their questions and send to other people to answer, With this coding that I have done for now is even quiet to use, but now my college professor asked me if I could do to store the score and enrollment of the person online, Now another challenge for me kkk have no idea how to use online in C xD

  • I’ll settle for coding the same content and try to see something with Online on C to try to make scoring system but thanks for all/ I don’t even know if C has anything on online kk

Show 2 more comments

1 answer

1

I know it’s been a while but the question has a clear answer: a text file is nothing more than a sequential of characters. So, does not have any feature that allows doing anything other than storing such character sequences which can be read perfectly by any programs.

The exception, not to say that there is no, gets the permission read/run/write files according to users of a device or application, where each user sends and unmails in their own files. For example: [email protected] does not read emails from [email protected] unless it allows it. But this file management is another completely different theme and that does not apply to the case.

To achieve your goal, you can follow one of the suggestions that you were given in the question: from creating a ZIP (or equivalent) with the plain text file. Of course it would not be as trivial as simply manipulating a simple text file.

Another alternative is to create your own file template with its encryption. Thus, only your program could decrypt

Browser other questions tagged

You are not signed in. Login or sign up in order to post.