Main Site Documentation

SD files accessing problems


When accessing files on the SD card, I get:

  1. the file exists, open to append, get System.ArgumentException
  2. file does not exist, open with OpenOrCreate, get system.argumentexception
    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?


uc5550, ucm revE,UD700


Please post simple piece of code showing the error. Have you seen this?

        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);

The DataDefs.CF.Open:

    // Open a file
    //  using filemode
    public bool Open(string filename, FileMode fm)
        this.filename = filename;
            file = new FileStream($@"{drive.Name}{filename}", fm, FileAccess.ReadWrite);
        catch (Exception E)
        return true;


Found the problem: The filename has illegal characters