Options

ASCII file output, weird permissions problem?

NickANickA Member Posts: 32
Hi,

I have an interface process triggered once a minute using a forms timer tick. After the interface process completes an ASCII file log is generated showing whether the process returned a failure result and any records that failed to process.

The first time the interface window is run the log file is created. As the time ticks it quite happily re-opens and appends to the log file.

However, if the window is closed, then re-run I get a permissions error:
The operating system cannot gain access to the file <file+path>. Please check the file type and attributes are correct.

I've checked permissions, they're fine. Nothing else has the ASCII file locked either.

Simplified code sample:
fLogFile.TEXTMODE(TRUE);
IF NOT fLogFile.OPEN(<file+path>) THEN
    IF NOT fLogFile.CREATE(<file+path>) THEN
        EXIT;

fLogFile.SEEK(fLogFile.LEN);

cLogText := FORMAT(TODAY) + ' ' + FORMAT(TIME);
fLogFile.WRITE(cLogText);

....
....

fLogFile.CLOSE;

Using the debugger the failure is actually occurring at the .WRITE.

Any help greatly appreciated.

TIA, Nick.

Comments

  • Options
    pevankpevank Member Posts: 7
    Try

    Write(Tekstfile,......)
  • Options
    pevankpevank Member Posts: 7
    AND

    File.TEXTMODE(TRUE);
    File.WRITEMODE(TRUE);
  • Options
    NickANickA Member Posts: 32
    .WRITEMODE fixed it, thanks :D
Sign In or Register to comment.