Errors, bugs, questions - page 327

 
mrProF:
At a glance, the whole file is written to str...
Add FILE_ANSI flag, as it reads unicode by default:)
Also, i will be 15 since there is a blank line at the end.
According to MQL5 documentation, FileReadString function "reads a string from file with current position of file pointer ... When reading from csv-file, the string will be read from the current position to the nearest separator or to the sign of the end of the text string". So I disagree that "the whole file is written". I tried using FILE_ANSI, but it does not work. About the empty line at the end: I don't quite understand, explain which line you're talking about.
 
DenisR:
According to MQL5 documentation, FileReadString function "reads a string from the current position of the file pointer ... When reading from csv-file, the string will be read from current position to the nearest separator or to the end of text string sign". So I disagree that "the whole file is written". I tried using FILE_ANSI, but it does not work. Regarding the empty string at the end: I don't quite understand, clarify which string you're talking about.

It's if it'll find a comma correctly, if encoding doesn't match, it may not see it.
I'll look at it with debugger.
I copied your code, added the flag - everything is ok.
 
And so, here are the results, as I said.
Without ansi it reads abracadabra and without seeing commas, it flies to the end of the file.
With ansi, it reads fine.
See attachments.
Files:
 
-Alexey-:
In MetaEditor, the "List of functions in file" button opens the list. If I scroll it down, it ends at P, and does not move further (black triangle facing down becomes inactive), although there are classes to the letter R. Please fix it.

Need more details.

Build, file, resolution...

Just tried it on ChartObject.mqh file - it scrolls up and down.

 
mrProF:
And so, here are the results, as I said.
Without ansi it reads abracadabra and without seeing the commas, it flies to the end of the file.
With ansi, it reads fine.
See attachments.
From ansi I have it reading (5 505 1009), i.e. i is now 5 instead of 0 for some reason, file size is 505 as before and FileTell is 1009 as before. In MT4 the same script reads (15 505 505).
 
alexvd:

More details are needed.

Build, file, resolution...

Just tried it on ChartObject.mqh file - it scrolls up and down.

Interesting:
And at least approximate list size what? Maybe there's a limit to the size of the list...

-Aleksey-

Exactly 100 lines.


Interesting:

Experimented with one of my libraries (110 functions), it displays from 100 to 106 in the list (different number all the time, but not 110).

Build last, seems to be a problem with number of rows greater than 100. ChartObject.mqh has only 62 rows in the list. Resolution 1680x1050. Windows7, font scheme is enlarged fonts.

 
DenisR:
From ansi I have it reading (5 505 1009), i.e. i is now 5 instead of 0 for some reason, file size is 505 as before and FileTell is 1009 as before. In MT4 the same script reads (15 505 505).
Hmm, mine is 155091009.


//+------------------------------------------------------------------+
//|                                                         test.mq5 |
//|                                                           mrProF |
//|                                                          http:// |
//+------------------------------------------------------------------+
#property copyright "mrProF"
#property link      "http://"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+


void OnStart()
  {int handle;
   ulong i, size;
   double _Ask, _Bid;
   string str;
      
   handle = FileOpen("test.csv",FILE_CSV|FILE_READ|FILE_ANSI,',');
   
   if (handle != INVALID_HANDLE)
     {
      size = FileSize(handle);
      
      for (i = 0; i < size; i++)
        {
         str = FileReadString(handle);
         _Ask = FileReadNumber(handle);
         _Bid = FileReadNumber(handle);
        
         if (FileIsEnding(handle))
           {
            Print(i," ",size," ",FileTell(handle));
            break;
           }
        }
     }   
      
   FileClose(handle);

   return;

  }
//+------------------------------------------------------------------+


Try debugging line by line if you know how...

 
mrProF:
Hmm, I have 155091009.



I had 15 505 1009 too at first, but then the terminal updated to the latest version (408) and it became 5 505 1009. But in any case, the end of file sign cannot be bigger than the size of the file itself. That's my main concern at the moment.
 
alexvd:

More details are needed.

Build, file, resolution...

Just tried it on ChartObject.mqh file - scrolls up and down.

Builds 404 and 408, Win XP Prof SP3, 3.0 GHz CPU and 3.0 Gb RAM.

Font size and other settings (except colour) are standard.

Actions are as follows:

1. Create a library or any other program module;

2. Generate a set of procedures and functions which must exceed 100. In my case, it was 110 (I was mocking my migration library).

More specifically, the functions were 110, and the module came out with the size of about 3310 lines.

3. Compiling the module;

4. We are trying to look through the list of functions.

In the list I saw from 100 to 106 functions (with each re-compilation a different number and composition of functions). At first the names of 106 functions were displayed, and then the number started decreasing.

At the same time, all 110 functions were never in the list.

PS

Another strange thing - I don't know after how many functions (but definitely less than 50) new functions stopped appearing in the list after the first compilation, I had to do two or three recompilations.

I propose either to change the order of formation of the list, for example to allocate individual classes in the form of a group menu (with the display of "stuffing" class in a separate list), or organize a separate manager, like the one in Delphi (discussion of such a request has already been on the forum).

 
-Alexey-:
alexvd:

More details are needed.

Build, file, resolution...

Just tried it on ChartObject.mqh file - it scrolls up and down.

Bild last, seems to be a problem with the number of lines greater than 100. ChartObject.mqh has only 62 rows in the list. Resolution 1680x1050. Windows7, font scheme is enlarged fonts.

Yes, reproduced it.

Thanks, let's have a look.

Reason: