最近因為有些原因 , 需要讀取外部的資料檔 , 但又不想動用到 dataN , 所以本來是想用MC_IO.dll
拿來用 , 但是好像遇到一些問題 , 所以索性乾脆自己發展一組 , 只能適用於 MC 專業版 , 不適用於
MC 券商版 , x64 的部分個人有在用 , x86 的部分因為自己沒灌 , 所以就只提供不測試了 , 附上原始碼 .
是用免費的 Dev C++ 5.8.0 版編譯的 , 有做一些防護 , 以免像 MC_IO.dll 檔案不存在 MC 會有 crash
的風險
附上 Dev C++ 5.8.0 版的鏈結 , 這是一個免費的 C++ IDE 編譯器 , http://orwelldevcpp.blogspot.tw/
提供一個使用範例 :
vars: value2(0); // file position pointer
vars: idx (0);
vars: DigitStr("");
if LastBarOnChart and BarStatus(1)=2 then
begin
FileDelete( "e:\hello.txt" );
value2 = 0;
for idx=0 to 2000
begin
value2 = _FIO_ReadDigit( "filename.txt" , value2 , DigitStr );
_FIO_Write( "e:\hello.txt", text(doublequote,DigitStr,doublequote,Spaces(30-Strlen(DigitStr)), value2:8:0 ) , 1 );
end;
end;
轉貼~ |