Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 692

 
Konstantin Nikitin:

FileWriteArray

With flag FILE_TXT it does not write. It just creates an empty file.
 
Karlinvain:
With flag FILE_TXT it does not write. It just creates an empty file.

Well, convert it to a string array, it will.

 
Konstantin Nikitin:

Well, convert it to a string array, it will write it.

I don't get it. Doesn't it do an automatic type conversion? Or what do you mean?

upd. If I change the array type to string, it does it. But I need to continue to work with numbers, not strings.

How to overload the entire array into a string array, just by looping and casting each element?

 
Karlinvain:

I don't get it. Doesn't it do an automatic type conversion? Or what do you mean?

upd. If I change the array type to string, it does it. But I need to continue to work with numbers, not strings.

How can I override the entire array into a string array?


If you want to correct it later in manual mode, then convert it to a string array when writing. When reading from file, you will have to fetch it back.
And if you just save it for further work. Then use BIN format.

 
Konstantin Nikitin:


If you want to edit this manually afterwards, then convert it to a string array when writing. When reading from a file, you will have to fetch it back.
And if you just save it for further work. Then use BIN format.

Sorry, I'm being obtuse. BIN is unreadable. How to read a file written with BIN?
 
Karlinvain:
Sorry, I'm stupid. The BIN is written unreadable. How to read a file written with BIN afterwards?

Read with the software or with the eyes by opening the written file???

 
Alexey Viktorov:

Read by software or by eye, by opening the recorded file???

That's how you read it with your eyes - not notepad but a hexadecimal editor or what?
 
Karlinvain:
That's how the Krakoziambs are read with their eyes)) you don't need a notepad but a hex editor or what?

You have to give a specific answer to a specific question.

HOW do you want to read what is written? Programmatically or by opening a file to read with your eyes?

 
Alexey Viktorov:

A specific question needs a specific answer.

HOW do you want to read what's written down? Programmatically or by opening the file and reading it with your eyes?

  int h=FileOpen("test",FILE_WRITE|FILE_BIN);
      FileWriteArray(h,array,0,WHOLE_ARRAY);
      FileClose(h);	

I then open it with notepad++

 
Karlinvain:

I then open it with Notepad++

The array is written only to a .bin file and to open it for reading by eye... I don't know such an application, it's unlikely to exist. In order to be able to read what is written, you need to write it to .csv or .txt format, respectively, with other functions in a loop, not FileWriteArray().

Reason: