KertLopper:
...but how to modify the file for smooth working
- if I don't know how many files exist
- if I don't know the name of the files
Just use FileFindFirst(), FileFindNext() and FileFindClose()
Thank you but I've rather thought about some loop.
Does anyone have an idea how to build loops for this ?
KertLopper:
Of course you have to use these functions in a loop. See the documentation https://www.mql5.com/en/docs/files/filefindfirst
Thank you but I've rather thought about some loop.
Does anyone have an idea how to build loops for this ?

Documentation on MQL5: File Functions / FileFindFirst
- www.mql5.com
[in] Search filter. A subdirectory (or sequence of nested subdirectories) relative to the \Files directory, in which files should be searched for, can be specified in the filter. [out] The returned parameter, where, in case of success, the name of the first found file or subdirectory is placed. Only the file name is returned (including the...
Petr Nosek:
Of course you have to use these functions in a loop. See the documentation https://www.mql5.com/en/docs/files/filefindfirst
Thank You!
All works fine.
Full code below (if somebody will need it for ourself)
void OnStart() { string file_name; string int_dir=""; int i=1; int handle; string str; string str1; long search_handle=FileFindFirst("*",file_name); if(search_handle!=INVALID_HANDLE) { do { FileIsExist(int_dir+file_name); handle=FileOpen(file_name , FILE_CSV|FILE_READ); if(handle>0) { str=FileReadString(handle); str1=FileReadString(handle); printf("handle:" +handle + "; str:"+str + "; str1:" + str1); } i++; } while(FileFindNext(search_handle,file_name)); { FileFindClose(search_handle); } } }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
many thanks for help