ASCII file output, weird permissions problem?

NickA
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:
I've checked permissions, they're fine. Nothing else has the ASCII file locked either.
Simplified code sample:
Using the debugger the failure is actually occurring at the .WRITE.
Any help greatly appreciated.
TIA, Nick.
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.
0
Comments
-
Try
Write(Tekstfile,......)0 -
AND
File.TEXTMODE(TRUE);
File.WRITEMODE(TRUE);0 -
.WRITEMODE fixed it, thanks0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions