Hi NooM,
Thanks for your response, but this is the output:
A first chance exception of type 'System.NotSupportedException' occurred in Microsoft.SPOT.IO.dll
A first chance exception of type 'System.NotSupportedException' occurred in System.IO.dll
An unhandled exception of type 'System.NotSupportedException' occurred in System.IO.dll
Any ideas?
Here's the code I'm using:
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
namespace MicroSD_Card_Writer_Example
{
public class Program
{
static String rootDirectory = @"SD";
public static void Main()
{
Program pgrm = new Program();
pgrm.Log("Hello, world!");
}
public void Log(String Text)
{
lock (this)
{
using (StreamWriter writer = new StreamWriter(rootDirectory + "log.txt", true))
{
writer.WriteLine(DateTime.Now + ": " + Text);
}
}
}
}
}
References listed in Visual C# 2010 Express are the defaults for the Netduino Plus 2 template, along with System.IO (required because of the StreamWriter):
Microsoft.SPOT.Hardware (Version 4.2.0.0)
Microsoft.SPOT.Hardware.PWM (Version 4.2.0.1)
Microsoft.SPOT.Hardware.SerialPort (Version 4.2.0.0)
Microsoft.SPOT.Hardware.Native (Version 4.2.0.0)
Microsoft.SPOT.Hardware.Net (Version 4.2.0.0)
mscorlib (Version 4.2.0.0)
SecretLabs.NETMF.Hardware (Version 4.2.0.0)
SecretLabs.NETMF.Hardware.Netduino (Version 4.2.1.0)
System (Version 4.2.0.0)
System.IO (Version 4.2.0.0)