When accessing files on the SD card, I get:
- the file exists, open to append, get System.ArgumentException
- file does not exist, open with OpenOrCreate, get system.argumentexception
Also:
file does not exist, open with Create, CreateNew or Open all result in ArgumentException
(could not change original post to include category)
I deleted the old thread. Which boards are you using?
if (Mode == LogModes.L_Full || Mode == LogModes.L_Streaming) // write the datapoints to the file
{
LogFileName = "TestData" + DateTime.Now.ToString() + ".csv";
DataDefs.CF.Open(LogFileName, FileMode.OpenOrCreate);
DataDefs.CF.WriteStrings(LogEntries);
DataDefs.CF.Close();
}
The DataDefs.CF.Open:
//////////////////////////////////////////////////////////////////////////////
// Open a file
// using filemode
public bool Open(string filename, FileMode fm)
{
this.filename = filename;
try
{
file = new FileStream($@"{drive.Name}{filename}", fm, FileAccess.ReadWrite);
}
catch (Exception E)
{
Debug.WriteLine(E.Message);
}
return true;
}
Found the problem: The filename has illegal characters