I am running the following code on the Cerbuino Bee and get the following errory when reading a file.
A first chance exception of type ‘System.IO.IOException’ occurred in Microsoft.SPOT.IO.dll
An unhandled exception of type ‘System.IO.IOException’ occurred in Microsoft.SPOT.IO.dll
I have tried both a 2gb card and 32gb card. Both produce the same results. The exception occurs at different locations in the file each time the program runs. I also tried using try/catch and attempting the read again, but still get the exception.
StorageDev.MountSD();
FileStream FileHandle = new FileStream(@ "\SD\test.bin", FileMode.Open, FileAccess.Read, FileShare.None);
byte[] seq = new byte[1024];
Debug.Print("Free mem : " + Debug.GC(true).ToString());
while (FileHandle.Position < FileHandle.Length)
{
int read_count = FileHandle.Read(seq, 0, seq.Length);
Debug.Print (read_count.ToString());
}
Any ideas? Thank you.