Hey guys any response from Metaquotes here will be helpful.
This code is not working
string m_file = "-Weights-"; string BufferWeights[8][8];//Static array declared globally but shown here for clarity int handle = FileOpen(m_file+".dat",FILE_READ|FILE_WRITE|FILE_BIN); if(handle!=INVALID_HANDLE) { FileWriteArray(handle,BufferWeights,0,WHOLE_ARRAY); FileClose(handle); } if(handle==INVALID_HANDLE) { printf(__FUNCTION__+": error writing weights to file"); }
I have also tried this but I get same results
int handle = FileOpen(m_file+".dat",FILE_SHARE_WRITE|FILE_WRITE|FILE_BIN);
int handle = FileOpen(m_file+".dat",FILE_SHARE_WRITE|FILE_READ|FILE_WRITE|FILE_BIN);
Please help
- www.mql5.com
Strings cannot be written to a binary file. Use FILE_TXT instead of FILE_BIN to open a text file.
Can someone please help me with reading array files. This code now keeps throwing up error 5004
//----------------------------------------------------------------------------------------------------- //All these options for the file path of the read file, "m_weights_file", throw up errors 5004 or 5002 //----------------------------------------------------------------------------------------------------- m_weights_file = /*TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL5\\"+*/"SOMWeights " + IntegerToString(ArraySize(GridWeights))+".dat"; //m_weights_file="D:\Program Files\MetaTrader 5\MQL5\Files\SOMWeights 20736.dat"; int handle = FileOpen(m_weights_file,FILE_READ|FILE_TXT|FILE_ANSI); if(handle!=INVALID_HANDLE) { printf(__FUNCTION__+" Read array!! "); FileReadArray(handle,GridWeights,0,WHOLE_ARRAY); FileClose(handle); } if(handle==INVALID_HANDLE) { printf(__FUNCTION__+" unable to read array @ "+m_weights_file+" !!... "+string(GetLastError()));// this is the error I keep getting... }
Any help on resolving this will be highly appreciated. The .dat file stores strings written from an array.
Can someone please help me with reading array files. This code now keeps throwing up error 5004
Any help on resolving this will be highly appreciated. The .dat file stores strings written from an array.
The tester file property is also not workin...
#property tester_file "SOMWeights 20736.dat" //--- m_weights_file="SOMWeights 20736"; int handle = FileOpen(m_weights_file,FILE_READ|FILE_TXT|FILE_ANSI); //same code as above...
I still get error 5004 despite the fact that the file is present in the MQL5\files directory.
m_weights_file="SOMWeights 20736";
Where extension?- 2009.11.23
- Андрей
- www.mql5.com
I have just reported this to service desk but I was wondering if anybody else having same problem.
I cannot create dat or csv files from an array even though the array has data.