File in use ?

i have to read a text file in Axapta. I’ll use an AsciiIo class for that, but before reading any record, i have to be sure that this file isn’t in use. I tried using winapi functions like this : winapi::movefile(‘c:\f1.txt’,‘c:\f2.txt’); print winapi::getlasterror(); to test this method, i open my f1.txt file in notepad, typing anything on first line, then, i run my method : no error detected, and file is really moved. [:(] If anyone can help me, on how to do this, thanks laurent

Hi Laurent, I have tried this, and I think that using Notepad is not real test case. It appears that Notepad opens the file for reading, and after reading it, closes the file handle. Which probabily is not the case with some MS Office tools like MS Word. I tried running your job on open MS Word file, and I got error code 32. Running on file open with Notepad, produced no error (that is error code 0). Why do you want to make sure that AsciIo file is not in use?

Thanks for your answer, i didn’t try with MS Word [:o] This file will be created by an application running on an AS-400 server (IBM inet series) and i want to to be sure that the process is completed before reading this message file.