
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello
I prepared a software in C# for reading and writing files which are used to communicate with my expert advisor. This is a sampple code part:
f = new FileStream ( "ExpertSave.txt", FileMode .Open, FileAccess .Read, FileShare .None);
if (f.CanRead)
{
StreamReader S = new StreamReader (f);
int CurrentState = 0; //1=General, 2=Trades,3=TradeErrors,4=Hirarchy,5=HirarchyErrors
PrevPassWord = PassWord; //Check if password is changed;
PrevChannelID = ChannelID;
PrevVer = Version;
.
.
.
S.Close();
f.Close();
}
FileStream fs3 = new FileStream ( "Errors.txt", FileMode .Create, FileAccess .Write, FileShare .None);
StreamWriter f3 = new StreamWriter (fs3);
f3.WriteLine(MSG );
f3.Close();
fs3.Close();
and this is a sample mql code:
int ProxySave=FileOpen("ProxySave.txt",FILE_READ|FILE_CSV );
if(ProxySave!=-1)
{
Txt=FileReadString(ProxySave);//##General
Txt=FileReadString(ProxySave);
RandomNumber=StrToInteger(Txt);
.
.
.
}
in most computers there is no error, but in compute of one of clients, we get this error and then metatrader halts:
The process cannot access the file 'D:\program files\FIBO Group main\experts\files\ExpertSave.txt' because it is being used by another process.
Object reference not set to an instance of an object
I should add, in this special case, even using FileShare .Read or FileShare .Write also gives the same result.
Could you please advise?