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.

600mL

Member Since 31 Oct 2012
Offline Last Active Aug 19 2015 11:02 PM
-----

#58445 Committing File to SD Card

Posted by 600mL on 28 May 2014 - 03:07 AM

it's an essential problem. I just wonder to buy N+2, but after read this thread....  I think twice, maybe it's ok to keep develop my project using N+  :wacko:

 

It works fine if you flush afterwards, eg:

        public void writeToFile(string data)
        {
            using (FileStream filestream = new FileStream(filename, FileMode.Append))
            {
                using (StreamWriter write = new StreamWriter(filestream))
                {
                    write.WriteLine(DateTime.Now + "," + data);
                }
            }
                        
            VolumeInfo.GetVolumes()[0].FlushAll();      // Force write to sd card
        }

In any case, even if you do not flush, the card will be written to eventually. I believe the data is buffered in memory and then written to when it reaches a certain level. I think this is to avoid too many short read/write operations to the SD Card which will probably impact on performance.




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.