Problem with writing in the file

Hello,

I did a small code which create a file if it doesn’t exist and write lines in it. I tried with the classic version of dynamics NAV it seem’s work fine but when I execute it with RTC version I have a message which tell that the file is opened by another application !!! (I think because there is a service which create the file …)

How could I correct that ?

My code is :

Path := ‘c:\TEMP\Test.txt’;

IF EXISTS(Path) THEN

ERASE(Path);

myFile.TEXTMODE(TRUE);

myFile.CREATE(nomFichier);

myFileWRITEMODE(TRUE);

REPEAT

myFile.WRITE(‘Line Text XXXXXXX’);

UNTIL xxxxxxxx;

myFile.CLOSE;

Thank for your help.

Sorry I made a small mistake when I was translating :slight_smile: :

myFile.CREATE(Path);