|
void writeTofile(string content) { handle=FileOpen("Fx68com.txt",FILE_CSV|FILE_WRITE); FileClose(handle); handle=FileOpen("Fx68com.txt",FILE_CSV|FILE_READ|FILE_WRITE); FileWrite(handle,content); FileClose(handle); } 但是EA只可以操作MT4目录下面的文件,通常在experts\files目录下,对非制定目录的文件操作就无能为力了。有人就编了dll文件来调用,其实MT4是可以直接调用windows的api的,比如要复制文件,可以这样: #import "Kernel32.dll" bool CopyFilEA (string source_file, string destination_file, bool if_exist); #import 调用: bool copy=CopyFilEA(MT4_main+"\experts\files\Fx68com.txt",fn,0); if(copy==true) Print(TimeCurrent(),",复制命令成功!",fn); 其中fn为你要复制到的地方(完整目录+文件名)。注意调用的时候在原来MT4目录下的文件也要写完整目录,不能像直接操作只写文件名。 |
EA入门学院