Difficulty using FileReadString on file opened outside /experts/files

 

Hi,


I wrote a script to check my email and parse the messages it recieves into an easily readable format OrderType;Symbol;SL;TP1;TP2;TP3; etc....

The same script then writes a new .txt file containing this information into \files\Symbol\signal.txt.

This file is then read and the order executed by an EA running on each chart.


I am using an include file created by codersguru called gFiles.mqh to allow me to operate outside the default directories. Once I have opened the file using gFileOpen() I pass the handle to FileReadString(). Unfortunately this function returns "invalid function parameter" everytime however. If I use normal FileOpen() to open a file in the default directory there is no problem however. Is there any way I can get this to work?

(My current fix is just when writing the files to name them GBPUSD_signal.txt instead and just have each EA search for their own file, but I would still like to see if there is another way, and my files directory is getting rather cluttered at the moment)

 
whitebloodcell wrote >>

Hi,

I wrote a script to check my email and parse the messages it recieves into an easily readable format OrderType;Symbol;SL;TP1;TP2;TP3; etc....

The same script then writes a new .txt file containing this information into \files\Symbol\signal.txt.

This file is then read and the order executed by an EA running on each chart.

I am using an include file created by codersguru called gFiles.mqh to allow me to operate outside the default directories. Once I have opened the file using gFileOpen() I pass the handle to FileReadString(). Unfortunately this function returns "invalid function parameter" everytime however. If I use normal FileOpen() to open a file in the default directory there is no problem however. Is there any way I can get this to work?

(My current fix is just when writing the files to name them GBPUSD_signal.txt instead and just have each EA search for their own file, but I would still like to see if there is another way, and my files directory is getting rather cluttered at the moment)

I think you can not mix two file management libraries. If you open file with cguru library use its read functions. If you will try use MT read function with handle from another library it will crash.

 

Hello wbc

You can play with windows api functions via import functionality.

'File Operations without Limitations' can help.

Last but not least - this link will not dissapoint 'File Operations via WinAPI'

.

please remember that this info above, I easily found via search bar. Learn to use all times as is great tool.

hth

 
Thank you for the links. I had looked at and read them, I use the grouped file operations to find out all the file names. For some reason though I haven't been able to get the read functions to work well with the rest of my code.
 
whitebloodcell wrote >>
Thank you for the links. I had looked at and read them, I use the grouped file operations to find out all the file names. For some reason though I haven't been able to get the read functions to work well with the rest of my code.

ah... well then, is for sure some little issue.

As alternative, consider visiting msdn and looking at the API docs for wins file i/o functions, those you find interesting will, if you follow the api and using already used site code as reference, surely give you what after.

I've not used win file ()'s but have done research at msdn for other functions and was successful, eg, keyboard, mouse api stuff.

Well, best fortunes to you.

for sure must be other code lurking around on site or indeed via google, other sites!

 
fbj:

You can play with windows api functions via import functionality.

'File Operations without Limitations' can help.

or 'Reading and writing files anywhere on disk using CreateFileA() etc.'.

Reason: