I am having a problem with SD card file corruption when the power is cycled. If I write to the card and then later interrupt the power, the file is set to 0kB. The problem does not seem to happen if no writes have occurred since the last power up.
philG
Here's the write routine:
public static void writeAllSettingsToSD(ArrayList settings) { if (!VolumeExist()) { SDError = SDCardError.NoSDCard; throw new IOException("NO SD card"); } if (settings != null) { if (settings.Count != 0) { try { using (StreamWriter file = new StreamWriter(ROOTPATH + SETTINGSPATH, !append)) //fix this { foreach (string setting in settings) { file.WriteLine(setting); } file.Flush(); file.Close(); } } catch (IOException) { SDError = SDCardError.FileWriteError; throw new IOException("SD Settings WRITE problem"); } } //end if settings count != 0 } //end if settings != null } //end writeToSD