The following code throws an I/O exception
string message = "This is a test";
try
{
System.Collections.IEnumerable x = Directory.EnumerateDirectories(@"SD");
}
catch (Exception exc)
{
message = exc.Message;
}
  | ||||||||||||||
7 replies to this topic
#1Posted 23 August 2013 - 12:10 AM The following code throws an I/O exception
string message = "This is a test"; try { System.Collections.IEnumerable x = Directory.EnumerateDirectories(@"SD"); } catch (Exception exc) { message = exc.Message; }
#2Posted 23 August 2013 - 02:59 PM I get an exception when trying to write read a micros SD card 4GB Fat32 using a netduino 2 plus
Exception was thrown: System.NotSupportedException Stack Trace Microsoft.SPOT.IO.NativeIO::GetAttributes
Code is try { using (StreamWriter SW = new StreamWriter("SDtest.txt")) SW.WriteLine("test"); using (StreamReader SR = new StreamReader("SDtest.txt")) Debug.Print(SR.ReadLine()); } catch (Exception exc) { message = exc.Message; }
Can anyone help please ? #3Posted 23 August 2013 - 03:09 PM I have tested this on two different netduino 2 +
I have tried SD cards 2GB, 4 GB, 8GB.
I use Micro framework version 4.2
Can anyone help, please #4Posted 23 August 2013 - 05:57 PM I am Having the same issue with my Netduino and SD cards.
Also I have been trying to use the simulator to write to and SD card.
That has also proven futile. Seems like the simulator does not support creating a directory.
So any hints on where to go would be great.
Thanks #5Posted 23 August 2013 - 05:59 PM I did the same test under the 4.3 Micro framework version. With the same result
string message = "This is a test"; try { System.Collections.IEnumerable x = Directory.EnumerateDirectories(@"SD"); } catch (Exception exc) { message = exc.Message; } #7Posted 28 August 2013 - 05:56 PM Got a new 2GB card today and I can read it now. However I could not buy that size in any store and I had to order it on the internet. Which leads to the following question:
Why are the newer SD cards (4GB, 8GB etc..) not supported? These cards are the only ones that can be purchased in brick and mortar stores. Are there any plans to lift this really restrictive restriction soon? #8Posted 29 August 2013 - 05:32 PM This is some code that works on my Netduino 2 + using VS Express for desktop 2012.
'*****Rem use this line for appending files '***** Dim MyStreamWriter As New StreamWriter(File.Open("sdsettingsmyfirstfile.txt", FileMode.Append)) '*****Rem writes over the existing file Dim MyStreamWriter As New StreamWriter(File.OpenWrite("sdsettingsMyfirstfile.txt")) MyStreamWriter.WriteLine("This is the first line.") MyStreamWriter.WriteLine("This is the second line.") MyStreamWriter.Flush() MyStreamWriter.BaseStream.Flush() MyStreamWriter.BaseStream.Close() MyStreamWriter.Dispose() Dim MyFileStream As FileStream = File.OpenRead("sdsettingsmyfirstfile.txt") Dim MyStreamReader As New StreamReader(MyFileStream) '****Rem Change this line to read one line MyStreamReader.ReadLine() 'Dim MyReadtoEnd As String = MyStreamReader.ReadToEnd Debug.Print(MyReadtoEnd) MyStreamReader.Close() MyStreamReader.Dispose()
0 user(s) are reading this topic0 members, 0 guests, 0 anonymous users | ||||||||||||||
|
||||||||||||||
This webpage is licensed under a Creative Commons Attribution-ShareAlike License. | ||||||||||||||