Error Message 4105

 

Thought I'd create very simple EA to try and understand how file I/O operations work. Documetnation states the file should be :-

terminal_directory\experts\files folder (terminal_directory\tester\files if for expert testing) or in its subfolders. But I can't find a file anywhere.

Handle - is shown as 1 by the ALERT

GetLastError code provides Zero - i.e. no errors.

Anyone know where my file maybe or indeed has a file been generated?


int start()
{
int handle;
int my_counter;
handle=FileOpen("My_test", FILE_CSV|FILE_WRITE, '|');
Alert("Handle = ",handle);
if (handle > 0)
{
my_counter = my_counter+1;
FileWrite(handle, 100*my_counter,200*my_counter);
Alert ("File I/O error code is ",GetLastError());
FileClose(handle);
}
return(0);
}

 
peterhw1:

terminal_directory\experts\files folder (terminal_directory\tester\files if for expert testing) or in its subfolders. But I can't find a file anywhere.

Handle - is shown as 1 by the ALERT

GetLastError code provides Zero - i.e. no errors.

Anyone know where my file maybe or indeed has a file been generated?

If you are using Vista, Windows 7, or Windows Server 2008 then the file may have been "virtualized" to another location on the disk. You may be dealing with scenario 2 from http://support.microsoft.com/kb/927387.

The simple way round this is not to install MetaTrader within the \Program Files area. Other solutions include turning off UAC, or changing the permissions of the files and directories in the MetaTrader installation.

The root cause is that Microsoft's guidelines have always told software developers not to do what MT4 does: put user data in the \Program Files area. MetaQuotes have unusually good reasons for doing this, but it's nevertheless a breach of Microsoft's age-old guidelines.

On Vista and later versions of Windows, the operating system will transparently move such file operations so that the files are put in an unprotected area of disk, e.g. C:\Users\User_name\AppData\Local\VirtualStore. It's designed as a way of keeping old software working while also maintaining the escalated security of Vista. However, it also leads to confusion where people are expecting to find their files in once place, but they're not actually there...

 
jjc:

If you are using Vista, Windows 7, or Windows Server 2008 then the file may have been "virtualized" to another location on the disk. You may be dealing with scenario 2 from http://support.microsoft.com/kb/927387.

The simple way round this is not to install MetaTrader within the \Program Files area. Other solutions include turning off UAC, or changing the permissions of the files and directories in the MetaTrader installation.

The root cause is that Microsoft's guidelines have always told software developers not to do what MT4 does: put user data in the \Program Files area. MetaQuotes have unusually good reasons for doing this, but it's nevertheless a breach of Microsoft's age-old guidelines.

On Vista and later versions of Windows, the operating system will transparently move such file operations so that the files are put in an unprotected area of disk, e.g. C:\Users\User_name\AppData\Local\VirtualStore. It's designed as a way of keeping old software working while also maintaining the escalated security of Vista. However, it also leads to confusion where people are expecting to find their files in once place, but they're not actually there...


Thanks for the reply.

I thought I was trying something 'simple' - started hours ago!

I am using Windows 7 - have program files and program files (86) areas on my C drive. Copies of MetaTrader are installed in program files (86).


I have changed all the files form non READ only in the MetaTrader installation and still no sign of my file!

My hard drive is about 320 GB and divided into C: & D:


I'll read the Microsoft Article above
 
peterhw1:

Thanks for the reply.

I thought I was trying something 'simple' - started hours ago!

I am using Windows 7 - have program files and program files (86) areas on my C drive. Copies of MetaTrader are installed in program files (86).


I have changed all the files form non READ only in the MetaTrader installation and still no sign of my file!

My hard drive is about 320 GB and divided into C: & D:


I'll read the Microsoft Article above
Thanks again - this did it - found the file

Scenario 2

To resolve this issue, use one of the following methods:
  • Click the Compatibility Files button that appears on the Explorer bar to view virtualized files in the folder. The Compatibility Files button appears only if there are virtualized files in the folder.
  • Look in the C:\Users\ User_name \AppData\Local\VirtualStore folder to locate files and folders.
  • Save your application's data in a folder under your user profile.
 
Much easier to install some place other then program files. IBFX defaults to C:\IBFX Trader 4
Reason: