Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

how do i add a password to a file in c++?

ok in c++ i can make a text file, i can edit the file a can "encrypt" and "decrypt"(change to char and do math on it), but what i would like to do is make it so someone who goes "my documents" and clicks "document2.txt" is prompted for a password.

Update:

ok noone seems to understand what i want ....(ive asked this question before) so example: when you try to open this you will see it has a pasword: http://www.mcgrawhill.ca/school/secondary/student/... i would like to do this to a text document using c++

2 Answers

Relevance
  • ?
    Lv 7
    1 decade ago
    Favorite Answer

    C++ can encrypt the file when it creates it, but it doesn't ride along with it to decrypt it for readers.

    For that you would have to assign a specific file type (filename extension) to a new C++ application, supply that application to the reader, and register the extension with Windows on the machine using the file with that extension.

    Hope that helps.

  • Anonymous
    1 decade ago

    That has nothing to do with the file, it would be done in the operating system, and Windows can't do it.

Still have questions? Get your answers by asking now.