title: Can two programs(a MQL5 and a c++) get access to a text file simultaneously?
body: <p>I'm trying to build an expert advisor with MQL5 and it actually has two parts:</p>
  <p>part one is a c++ code, which produces the commands(buy, sell) and writes it in a text file.
  part two is the MQL5 code which is intended to open that mentioned text file, read the command from it and execute it. My problem is that, since they have to have access to the text file almost simultaneously, sometime one of them tries to open the text file while the other one is still using it and has not closed it. at these points, the program returns an error because one part cannot open the text file and everything stops.</p>
  <p>My question is How I can solve the issue? Can MQL5 read the command line, so I can print the commands in command line and make MQL5 read them? Or is there any way to fix this access-at-same-time problem?</p>
  <p>C++ program is constantly checking if the text file is edited. Once the text file is edited, it opens it and read data from it. the problem is that the data is constantly being written in the text file almost every second. So, It happens many time during the process that while the MQL program tries to write new data in the text file, c++ program is still reading the old data from the file.</p>