FileOpen in include files?

 

Hi,

the 'how-to' of file open tells me:

...
Handles of files opened in the same module cannot be passed to other modules (libraries)

I do not exactly know what and how module is meant.

I want to open a file in an include, setTrds.mqh:

int iTr[10][50]
...
#define Se.HDL  41

   ...
   iTr[i][Se.HDL] = FileOpen( "Set "+i+" "+DayOfYear()+".log", FILE_BIN | FILE_READ | FILE_WRITE); 
   if( iTr[i][Se.HDL] != -1 ) FileSeek(iTr[i][Se.HDL], 0, SEEK_END);
   ...

which is loaded into the EA:

#include <setTrds.mqh>

1) Will the handle 'survive' until it is closed?
2) It won't be a problem to save the handle in an array? (I guess not, just to be save.)
3) Finally, what is meant by module?

Thanks in advance, gooly

 
gooly:

Hi,

the 'how-to' of file open tells me:

...
Handles of files opened in the same module cannot be passed to other modules (libraries)

I do not exactly know what and how module is meant.

I'm not exactly sure . . . but I think the distinction is between included code and libraries (modules) of pre-compiled code, a DLL is pre-compiled too.
 

hmm, ok, I'll see as of tomorrow.

Anyway thanks RaptorUK

gooly

 

gooly:

I want to open a file in an include, setTrds.mqh:

int iTr[10][50]
   iTr[i][Se.HDL] = FileOpen( "Set "+i+" "+DayOfYear()+".log", FILE_BIN | FILE_READ | FILE_WRITE); 

which is loaded into the EA:

1) Will the handle 'survive' until it is closed?
2) It won't be a problem to save the handle in an array? (I guess not, just to be save.)

If this is an included file, then that code is in your EA just as if you cut and pasted it into your EA. Of course the handle will survive in the array, because the array is common (globally declared) in your EA.

A module is a separately compiled unit, not an include file.

 
thanks!!
Reason: