I am trying to write to a SD card on my netduino. My code creates a File, but does not write to it... Here is my code from main:
public static void Main()
{
SerialPort port1 = new SerialPort("COM1", 57600, Parity.None, 8, StopBits.One);
port1.Open();
SerialPort Port2 = new SerialPort("COM2", 115200, Parity.None, 8, StopBits.One);
Port2.Open();
OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
FileStream fs = new FileStream("\\SD\\test.txt", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None, 512);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine("Hello World");
while (true)
{
}
}
Writing to SD card
Started by newfierich, May 10 2011 02:02 PM
2 replies to this topic
#1
Posted 10 May 2011 - 02:02 PM
#2
Posted 10 May 2011 - 06:59 PM
You must call sw.Close (either explicitly or as a part of using statement) to ensure that all data is written out to the underlying stream. For more details and sample code please have a look at the following topic.I am trying to write to a SD card on my netduino. My code creates a File, but does not write to it...
#3
Posted 12 May 2011 - 04:46 PM
@CW2 Thanks for pointing me to the proper topic. I missed it while searching earlier
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users