Read a file with text and binary information in .Net

I need to read PGM binary image files. Its format:

P5
# comments
nrows ncolumns
max-value
binary values start at this line. (totally nrows*ncolumns bytes/unsigned char)

I know how to do this in C or C ++ using the FILE handler by first reading a few lines and reading a binary block. But I do not know how to do this .Net.

+3
source share
2 answers

Try to learn the method Stream.Read(). This is how you read the binary in C #. This article is discussed while reading a PGM file.

+1
source

You should study System.IO.Stream (and its inheriting classes such as FileStream ) and various reader classes.

.

stream.Position = {index of byte};

, , , .

0

Source: https://habr.com/ru/post/1739253/


All Articles