Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Directory creation woes

SD directory

  • Please log in to reply
5 replies to this topic

#1 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 01 May 2013 - 11:33 PM

Hi all. I have this snip of code:

 

if (Directory.Exists(@"SD"))            {                green.Write(true);                red.Write(true);                //Directory.SetCurrentDirectory(@"SD");                Directory.CreateDirectory(@"SDone");                Thread.Sleep(1);                Directory.CreateDirectory(@"SDtwo");                Thread.Sleep(1);                Directory.CreateDirectory(@"SDthree");                Thread.Sleep(1);                Directory.CreateDirectory(@"SDfour");                Thread.Sleep(1);                Directory.CreateDirectory(@"SDfive");                Thread.Sleep(1);                Directory.CreateDirectory(@"SDsix");                Thread.Sleep(1);                foreach (string dir in Directory.GetDirectories(@"SD"))                {                    Debug.Print("I found: " + dir);                }                Thread.Sleep(100);                green.Write(false);                red.Write(false);            }

 

The debug output is:

I found: SDoneI found: SDtwoI found: SDthreeI found: SDfourI found: SDfiveI found: SDsix

 

But when I put the SD card in my computer, SDsix doesn't exist. What's going on?



#2 taylorza

taylorza

    New Member

  • Members
  • Pip
  • 1 posts

Posted 02 May 2013 - 12:15 AM

Have you unmounted the file system before removing the SD card and putting it in your computer?

#3 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 02 May 2013 - 01:25 AM

i guess it has something todo with buffering or stuff like that.

i had dataloss when i didnt unmount the sd card before shutting down the netduino/ remove the sd card.

 

so i made a button to unmount it, and everything was fine (except it sucked ...)



#4 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 02 May 2013 - 01:45 AM

i guess it has something todo with buffering or stuff like that.

i had dataloss when i didnt unmount the sd card before shutting down the netduino/ remove the sd card.

 

so i made a button to unmount it, and everything was fine (except it sucked ...)

I use feedback LEDs to indicate when the filestreams are disposed. I'm not getting data corruption, It's just not making directories.

 

And when it does, I can't create a file inside the directory.



#5 cutlass

cutlass

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationNew England. :)

Posted 02 May 2013 - 04:38 AM

Is there a "Flush()" subroutine in the netmf?

 

http://msdn.microsof...ream.flush.aspx

 

Namespace:  System.IO


C#
public abstract void Flush()



#6 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 02 May 2013 - 08:45 PM

Is there a "Flush()" subroutine in the netmf?

 

http://msdn.microsof...ream.flush.aspx

 

Namespace:  System.IO


C#
public abstract void Flush()

I'm not using any streams.







Also tagged with one or more of these keywords: SD, directory

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.