File Read/Write problems

 
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
 
FileReadArray function can be applied to bin files only not for csv
Reason: