I got a problem using FileOpen and FileWrite. The functions FileOpen and FileWrite seem to work (returns positive return val) but no file is created... see code below
I'll be gratefull for help.
code:
int outFile = FileOpen("testFileOpen.csv",FILE_CSV|FILE_WRITE,',');
if (outFile<=0){
Alert("File was not opened ");
}
else{
Alert("File was opened ");
int charsWritten = FileWrite(outFile,"test file write");
if (charsWritten <=0)
Alert("Cant write to file");
else
Alert(charsWritten," Chars written");
FileClose(outFile);
}
Question for clarity on my part??
Original is: int outFile = FileOpen("testFileOpen.csv",FILE_CSV|FILE_WRITE,',');
should it read: int outFile = FileOpen("c:\program files (x86)\MT4_trader\tester\files\testFileOpen.csv",FILE_CSV|FILE_WRITE,','); ???? I just need this to help clarify what MT4 does automatically, and what I need to specify.
Original is: int outFile = FileOpen("testFileOpen.csv",FILE_CSV|FILE_WRITE,',');
should it read: int outFile = FileOpen("c:\program files (x86)\MT4_trader\tester\files\testFileOpen.csv",FILE_CSV|FILE_WRITE,','); ???? I just need this to help clarify what MT4 does automatically, and what I need to specify.
Regards,
spgandau
Nope, just specify "testFileOpen.csv", no need to specify full address. In mql4 File functions operate in expert/file folder for forward trading, for back testing File functions automatically operate in tester/file folder
Hi Sip,
Can you tell me the name of the exe file that needs to be granted "Run as administrator"?
It's a UAC issue . . . do what WHRoeder said . . .
Don't install in \program files* on Vista/Win7. I've found that "Run as administrator" doesn't solve all issues.
Hi,
I got a problem using FileOpen and FileWrite. The functions FileOpen and FileWrite seem to work (returns positive return val) but no file is created... see code below
I'll be gratefull for help.
code:
int outFile = FileOpen("testFileOpen.csv",FILE_CSV|FILE_WRITE,',');
if (outFile<=0){
Alert("File was not opened ");
}
else{
Alert("File was opened ");
int charsWritten = FileWrite(outFile,"test file write");
if (charsWritten <=0)
Alert("Cant write to file");
else
Alert(charsWritten," Chars written");
FileClose(outFile);
}
Question for clarity on my part??
Original is: int outFile = FileOpen("testFileOpen.csv",FILE_CSV|FILE_WRITE,',');
should it read: int outFile = FileOpen("c:\program files (x86)\MT4_trader\tester\files\testFileOpen.csv",FILE_CSV|FILE_WRITE,','); ???? I just need this to help clarify what MT4 does automatically, and what I need to specify.
Regards,
spgandau
Question for clarity on my part??
Original is: int outFile = FileOpen("testFileOpen.csv",FILE_CSV|FILE_WRITE,',');
should it read: int outFile = FileOpen("c:\program files (x86)\MT4_trader\tester\files\testFileOpen.csv",FILE_CSV|FILE_WRITE,','); ???? I just need this to help clarify what MT4 does automatically, and what I need to specify.
Regards,
spgandau