Strange AsciiIO behavior

Hi there, I am working on a batch process that, among other things, records processed lines to a csv file (for an external system). When the process is done, the file is moved to an archive folder. If a file with the specified name already exists in this folder, it must be appended to rather than overwritten (see code below). While this works fine for most files, for some reason it fails on certain files. I have tried pretty much everything and now have to use a workaround involving an intermediate file. What ends up happening is that newFile is returned as NULL. I have tried using WinAPI::getLastError(), but it reports no errors, and there is no useful debugging information while stepping through the code. Has anyone else experienced something similr, or does anyone have any suggestions as to where to look for clues as to the cause? (note that while the obvious assumption would be that the file is locked for some reason, I can manually edit, rename or delete the file without any troubles) Thanks, Matt newFile = new AsciiIO(newFileName, “A”); oldFile = new AsciiIO(oldFileName, “R”); data =; while(data) { newFile.write(data); data =; } //Close and delete the old file oldFile = null; WinAPI::deleteFile(oldFileName);

Hi What version are you using? There is some known errors in the WinApi class. Some of them have been corrected in SP2 (also the GetLastError function). You can check that in the Fixlists for SP1 and SP2.