Hi there,
Using : https://www.mql5.com/en/articles/62 to create scripts in order to write and read objects&properties for a panel.
I had no problem for creating the write script (only a little change: FileWriteInteger from article need to replace by FileWriteLong)
However when reading the file to create the objects, I get the warning : implicit enum conversion, here is the lign:
ENUM_OBJECT obj_type=FileReadInteger(handle,4);
Follows the lign:
ObjectCreate(0, obj_name, obj_type, 0, 0, 0);
I have tried to change FileReadInteger to FileReadLong or even ENUM_OBJECT to long but no success.
Any ideas or suggestions? Thx...
Maybe the author of the article could do the change/updates to his article.
Well regardless of the warning message:
implicit enum conversion && possible loss of data due to type conversion
the script is working fine... but instead of FileReadInteger replace to FileReadLong.... Answer myself, thought it might help someone else.
...
ENUM_OBJECT obj_type=FileReadInteger(handle,4);
... I get the warning : implicit enum conversion
Well, an int, as returned by "FileReadInteger", can, in general, have more values than the enumeration type, so the compiler is warning you that the implicit conversion, as performed by the compiler, may not succeed. However, you can take the responsibility for the conversion by inserting an explicit cast!
ENUM_OBJECT obj_type = (ENUM_OBJECT)FileReadInteger(handle,4);
Cheers!
Nói chung, một int, như được trả về bởi "FileReadInteger", có thể có nhiều giá trị hơn danh sách kiểu, vì biên dịch đó đang cảnh báo bạn rằng chuyển đổi ngầm, được thực hiện bởi trình biên dịch, có thể không thành công. Tuy nhiên, bạn có thể chịu trách nhiệm về việc chuyển đổi bằng cách chèn một tổ hợp diễn viên rõ ràng!
Chúc mừng!
Thank you ! I get it .
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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 there,
Using : https://www.mql5.com/en/articles/62 to create scripts in order to write and read objects&properties for a panel.
I had no problem for creating the write script (only a little change: FileWriteInteger from article need to replace by FileWriteLong)
However when reading the file to create the objects, I get the warning : implicit enum conversion, here is the lign:
ENUM_OBJECT obj_type=FileReadInteger(handle,4);
Follows the lign:
ObjectCreate(0, obj_name, obj_type, 0, 0, 0);
I have tried to change FileReadInteger to FileReadLong or even ENUM_OBJECT to long but no success.
Any ideas or suggestions? Thx...
Maybe the author of the article could do the change/updates to his article.