Link to home
Start Free TrialLog in
Avatar of formi
formiFlag for Switzerland

asked on

ReWrite TextFile fires I/O Error 50


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

Open in new window

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?

Thanks, Peter
Avatar of Manuel Lopez-Michelone
Manuel Lopez-Michelone
Flag of Mexico image

I found the error described in

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.
good luck

Avatar of formi


thank you for this hint, but it doesn't solve my problem. I think it is really a network-problem. On local machines I didn't see this error.
Do you want to delete file after usage (and app exit) each time? And why you think that this is a network problem?
Is you file locally on disk or somewhere on local net?
Avatar of formi


no, I don't want delete it after usage. I want to rewrite it and then I get thiss error. And I think it is a network-issue because
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.

Avatar of formi


sorry, that was a bad example with "c:\". It is really only on a server-path. I modified it in my question above.

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.
Avatar of Martyn Spencer
Martyn Spencer
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial