Cannot Save CSV File on Windows Computer Using CODESYS and Control Win

2024-07-04
2024-07-04
  • psychoengineer - 2024-07-04

    I am currently working on a project using CODESYS and Control Win on a Windows computer. I've encountered an issue where I am unable to save a CSV file. I have followed the standard procedures and used the appropriate file handling functions, but the file is not being created or saved as expected.

    IF xStartTest THEN
        sFileName := '\logs.txt';
        sFileName := CONCAT(gvl.g_sMainDirectory, sFileName);
        sFileNameCopy := '\CAAFileCopy.txt';
        sFileNameCopy := CONCAT(gvl.g_sMainDirectory, sFileNameCopy);
        //eWriteState := FILE_OPEN_TRIGGER;
        xTestDone := FALSE;
        xError := FALSE;
        xStartTest := FALSE;
    END_IF
    
    VAR_GLOBAL
        g_sMainDirectory : STRING := 'C:\LogFiles'; // file path for CSV file
    END_VAR
    

    Despite this, the file does not appear in the specified directory, and no error messages are being generated. I've checked the directory permissions and ensured that the path is correct.

    Has anyone else experienced a similar issue or have any suggestions on how to resolve this? Any help would be greatly appreciated.

    Thank you!

     

Log in to post a comment.