.txt with password in C?

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

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

 5
Author: Renan Gomes, 2018-08-27

1 answers

I know it's been a while but the question has a clear answer: a text file is nothing more than a sequence of characters. Therefore, does not have any feature that allows you to do anything other than store such sequential characters that can be read perfectly by any programs.

The exception, not to say that it does not have , gets the permission to read/execute/write files according to users of a device or application, where each user sends and demanders in their own files. For example: [email protected] does not read emails from [email protected] unless he 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 they gave you in the question: from creating a ZIP (or equivalent) with the pure text file. Of course it would not be as trivial as simply manipulate a simple text file.

Another alternative is to create your own file template with your encryption. Thus, only your program would be able to decrypt

 1
Author: José, 2018-12-21 08:17:49