ufareed wrote:Is there some possible solution for it.
Try thinking of a different approach.
How about not using a text file, but some other file format and encrypting the data? No need to try and play tricky games with the machine's file system and achieves your apparent real goal of keeping the user from modifying his past answers.
ufareed wrote:What would be that file format? .docx??
I didn't have a specific 3rd party format in mind.
One possibility that I was thinking of is that some databases allow you to create encrypted databases. I believe both MS Access and SQLite have such capabilities.
The other thing I was thinking of was just to invent your own. Handle the file in binary mode and encrypt/decrypt it (or parts of it) yourself. The situation that you describe doesn't sound to me like it requires particularly high security. If this is the case, you don't need a strong encryption method. You could come up with something simple and easy to implement of your own. On the other hand, you could get go ahead and use the windows CryptoAPI or a 3rd party library.