This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
File Read/Write problemsBack to topics list |
|
bob12
2005.03.14 12:26
Hi All,
I'm having trouble using File Read/Write functions in MT4. In order to test these functions, i wrote the following code which tries to read an array from file A.csv and then write back the values into file B.csv. #property copyright "Copyright © 2005, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" double profit[10]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int handle; handle = FileOpen("A.csv", FILE_CSV|FILE_READ,","); if(handle<1) { Print("A.csv not found"); return(false); } if(handle > 0) { FileReadArray(handle, profit, 0, 10); FileClose(handle); } int handle2; handle2 = FileOpen("B.csv",FILE_CSV|FILE_WRITE,","); FileWriteArray(handle2, profit, 0, 10); } //+------------------------------------------------------------------+ No luck so far ... Any help would be highly appreciated. Thanks Bob ps: A.csv is created manually in the expert/files folder and contains 10 values |
|
Slawa
2005.03.14 12:51
FileReadArray function can be applied to bin files only not for csv
|
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
