Problem finding files

 

Hello everybody,

I'm new to both forum and MetaTrader. I use the XTB-trader-platform from X trade brokers. Writing to a file using the fileopen filewrite etc. functions does work (no negative values returned by fileopen-function), using fileread I can even read from the file established yet fail to find it in the windows explorer. No idea where it has been saved, I searched the obvious experts/files and tester/files directory, nothing available. Any ideas what I am doing wrong? My code as follows:


int DateiNr;

int init()
{
DateiNr=FileOpen("Logbuch.csv",FILE_WRITE,";");
Alert("DateiNr= "+ DateiNr); // Returns "DateiNr= 1" at runtime
return(0);
}

//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
FileClose(DateiNr);
int handle;
string str;
handle=FileOpen("Logbuch.csv",FILE_CSV|FILE_READ,';');
str=FileReadString(handle);
Alert("str= " + str); Returns "str= example" at runtime
if(handle<1)
{
Print("File not found, the last error is ", GetLastError());
return(false);
}
Alert("Handle= " + handle);Returns "Handle= 1" at runtime

FileClose(handle);
Alert("Ready!!");

return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
int retval= -3;
/*if (cnt==0)
{
double kaufpreis=1.3760;
double SL=1.3730;
ticket=OrderSend(Symbol(),OP_BUYSTOP,1,kaufpreis,3,SL,0,"Kommentar_Hotte",12345,0,Green);
cnt++;
}*/
retval=FileWrite(DateiNr,"example");
Alert (retval);Returns "8" at runtime
return(0);
}



Thank you very much in advance,

Hotte

 

If you're using Windows Vista it may be hiding the file to "help you" stay "safe". This is a common problem with Vista.

 

Hi tovan,

thank you very much for your help! This solved my problem!


Hotte