SD Card create directory
#1
Posted 21 June 2012 - 05:17 PM
#2
Posted 21 June 2012 - 11:27 PM
Hello,
I can write files to the SD\ root but can't manage to create directories..
I tried to use
Directory.SetCurrentDirectory("SD");
Directory.CreateDirectory("Netduino");
as in http://www.dyadica.c...d-card-example/
but nothing happens..
also tried to put the new directory in the filename while creating a filestream but i get exception.
I just tried the following one line of code with one of my boards. I am running version 4.2.0.0 RC4. The directory was successfully created, verified by mounting the SD card as a drive on my PC.
Directory.CreateDirectory(@"\SD\Netduino");
Perhaps you need a "\" before the "SD" ? Or perhaps you are using an older version of the OS ? In any case the above works on my N+.
#3
Posted 22 June 2012 - 03:25 AM
#4
Posted 26 June 2012 - 12:31 PM
#5
Posted 30 August 2012 - 09:38 AM
using System; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.IO; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; //using LoveElectronics.Sensors.Accelerometers; namespace ADXL345_test { public class Program { private static StreamWriter sw; private static FileStream fs; public static void Main() { OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); InputPort Switch1 = new InputPort(Pins.ONBOARD_SW1, true, Port.ResistorMode.Disabled); while (!Switch1.Read()) {} led.Write(true); Directory.CreateDirectory(@"SD\Netduino"); fs = new FileStream(@"SD\Netduino\test.txt", FileMode.Create, FileAccess.Write, FileShare.None, 512); Directory.CreateDirectory(@"SD\Netduino1"); sw = new StreamWriter(fs); Directory.CreateDirectory(@"\SD\Netduino2"); sw.WriteLine("test"); Directory.CreateDirectory(@"\SD\Netduino3"); sw.Close(); Directory.CreateDirectory(@"\SD\Netduino4"); fs.Close(); Directory.CreateDirectory(@"\SD\Netduino5"); } } }
#6
Posted 30 August 2012 - 10:05 AM
#7
Posted 30 August 2012 - 01:40 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users