views:

36

answers:

1

Is it possible to store some special content inside file header of ".txt" file using .Net ? If yes how ? Please give me a sample code.

+4  A: 

No, this is not possible. .txt files don't have a header. They are plain (text) files without any additional file structure.

If you need to attach additional information to a .txt file you might want to have a look at Alternate Data Streams which are available when you are using NTFS. However, alternate data streams are a feature of NTFS only and will not survive a file transfer via another medium beyond a simple file copy (web streaming, sending by email, etc).

As your question is tagged with encryption it looks as if you are trying to store additional encryption information or a digital signature with your .txt file. In such a case it might as well be an option for you to have a look at container formats such as zip.

0xA3