Delphi 10.1: I sometimes have the error 50 when I try to create a file:
f : TextFile;
ReWrite(f,'\\myServer\anyPath\myFile.txt'); //Error 50 if the file exists
I also tried to delete the file before if it exists. That is also impossible. Deleting in the explorer works and the I can ReWrite it. This error occurs in programs that never had problems. I think it has something to do with a Windows-Update. How can I solve this?
I/O error 50:
//IO Error 50L
//The network request is not supported
Is this make any sense to you in your software? I dont understand what is wrong.
Is you file locally on disk or somewhere on local net?
1. I never saw it on a local machine, only when the file is on a server.
2. The link above from Manuel says error 50 is a network-issue
If you are always creating/rewriting the file on the C: drive, it is unlikely to be a network error, as such. Are you closing the file properly having finished working on it? If not, a second request to rewrite it may be failing because the file is in use. Your code block does not make it clear that you are correctly closing the file.
If there where a problem with an opened file it couldn't be deleted in the windows-explorer - but it can be deleted there and after deleting it can be created in my program.