C # Primer or example of working with files at granular level

Can anyone provide an example or primer for working with files at a granular level with C #. Suppose I want to create a new program to compress and zip files. Can I write a program like this, from C #, that goes to the bit and byte level?

+2


a source to share


3 answers


You can read byte by byte with confidence using the FileStream class and the StreamReader class. The BinaryReader is even more detailed. With bytes, you will have the ability to work with a bit base with bit operators (|, &, <, →).

Examples can be found in posted links.



PS: You can use SharpZipLib or .Net compression classes to compress files.

+5


a source


I don't know of a good tutorial, but BinaryReader is a good place to start reading at the bit-and-byte level



+1


a source


You can download the free #ziplib library including the C # source code here:

http://www.icsharpcode.net/opensource/sharpziplib/

This should show you at least changing files.

0


a source







All Articles