hi!
i am trying to get through all files of a directory. i found this code, and wrote an EA with it, but it doesnt work.
This code should print all names of the files, but it doesnt. do you know why?
thanks for help
hi marco, i dont need to transfer data via ftp any more. i found a way to use the data of the files in metatrader. i have a special analysis software who stores the result in its own folder, and i wanna use this data to read it into my metatrader and combine it with my analysis there to generate trades. you know what i mean? ;)
in the code above i would say the bufferToString() function doesnt work well. i am a bit confused.
I think that you have to use Windows ..W() functions of kernel32.dll since b600+
#import "kernel32.dll" int FindFirstFileW(string path, int& answer[]); bool FindNextFileW(int handle, int& answer[]); bool FindClose(int handle);
BTW: an error code or message would be helpful for those who want to help you!
Oh yeah, thats great! i played with it and it works:
#import "kernel32.dll" int FindFirstFileW(string path, int& answer[]); bool FindNextFileW(int handle, int& answer[]); bool FindClose(int handle); //#import //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int init() { //---- int win32_DATA[79]; string param= "C:\\analysis\\*.*"; Print (param); int cnt = 0; int handle = FindFirstFileW( param ,win32_DATA); Print("file",cnt++, bufferToString(win32_DATA)); ArrayInitialize(win32_DATA,0); while (FindNextFileW(handle,win32_DATA)) { Print("file",cnt++, bufferToString(win32_DATA)); ArrayInitialize(win32_DATA,0); } if (handle>0) FindClose(handle); ExpertRemove(); //---- return(0); } //------------------------------------ int deinit() { return(0); } //------------------------------------ int start() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| read text from buffer | //+------------------------------------------------------------------+ string bufferToString(int buffer[]) { string text=""; int pos = 10; for (int i=0; i<64; i++) { pos++; int curr = buffer[pos]; text = text + CharToStr(curr & 0x000000FF) +CharToStr(curr >> 16 & 0x000000FF); } return (text); }
i changed to the FindFirstFileW() and the bufferToString() function. now it works. thx!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi!
i am trying to get through all files of a directory. i found this code, and wrote an EA with it, but it doesnt work.
This code should print all names of the files, but it doesnt. do you know why?
thanks for help