Main Site Documentation

StreamReader buffer length?


#1

Hello TinyCLR,

I’ve worked with a FEZ Cobra for a few eeks now and just started using the SD cardreader in an actual project.
Untill now I’ve tested it by reading and writing small files, which never gave any problems.

The thing is: I need to read a file with close to 7000 lines from a card, and the StreamReader’s ReadBlock() and ReadLine() both stop reading halfway through line 4086 (after char 59450 to be precise).

I was wondering why this happens. Is there something wrong with the netmf StreamReader, something with the SD driver, is the read buffer too small to read all 7000 lines, …?

I tried to work around it by reading the file in parts but I can’t seem to be able to tell the reader to start at a specific char, so I have to start at 0 every time I open a reader.

Anyone got an idea?


#2

you need to think small. Fez doesn’t have memory to read lots of data at once. You have to find a way to chunk the data down.


#3

Or I could just steal my own code right, and use FileHandle again instead of StreamReader… >.<

Sorry for bothering you, and thanks for the fast reply.


#4

Have had issues with SR.ReadLine(). It uses 8K buffer. Not sure if some MF memory allocation issue yet or not.