1

Topic: How different flows to read one text file?

Decided to break reading of the big files into small slices (that  the data did not exceed the RAM). For example, the first flow reads the first 100 MB of the file, the second flow reads from 100 to 200 MB, the third from 200 to 300 MB...
And so if files to divide into pieces on 100  (i.e. not to divide, because all files less than this size) handling is completed successfully. But as soon as I divide them on 100 MB through any time the program falls out with an error. By the way, the same algorithm of reading of files was long used earlier without division into slices and perfectly worked, i.e. the error as seems to me in multi-threaded reading of one file.
How to solve?

2

Re: How different flows to read one text file?

AlekseySQL wrote:

By the way, the same algorithm of reading of files was long used earlier without division into slices and perfectly worked, i.e. the error as seems to me in multi-threaded reading of one file.

I correctly understand that earlier the algorithm worked , and now ? I here would search for a problem, instead of in operation with a file.
And an error does not prevent to sound together with code line on which it happens.

3

Re: How different flows to read one text file?

Dima T wrote:

I correctly understand that earlier the algorithm worked , and now ? I here would search for a problem, instead of in operation with a file.
And an error does not prevent to sound together with code line on which it happens.

Yes, I set one-continuous algorithm on pieces of files. The error happens in standard libraries and is perfect in other place (most likely from - for already happened error which in any way did not show itself). Operation from files absolutely , as was, only now it is read by several flows simultaneously.

4

Re: How different flows to read one text file?

The algorithm of reading of a file is a standard sheaf: std:: iostream + getline ()

5

Re: How different flows to read one text file?

AlekseySQL wrote:

the algorithm of reading of a file is a standard sheaf: std:: iostream + getline ()

Give I will guess: at you one iostream on all flows?.

6

Re: How different flows to read one text file?

Dimitry Sibiryakov wrote:

Give I will guess: at you one iostream on all flows?.

Each flow creates the separate independent flow iostream and by means of it reads the range of lines of a file.

7

Re: How different flows to read one text file?

Means besides search for an error in other place. You can is to begin with attentive read its text.

8

Re: How different flows to read one text file?

AlekseySQL, from a topic clearly that you (once) had an one-continuous algorithm which normally worked and
Which you altered in multi-threaded and caught a bug. It is necessary to begin with it. You broke something.
Further you write
>> Each flow creates the separate independent flow iostream and by means of it reads the range of lines of a file.
Through some cycles of improving of this paradigm you will invent own Hadoop. Generally, if your disk
The subsystem not  that has no big sense  and reading of files on the maximum speed.

9

Re: How different flows to read one text file?

AlekseySQL wrote:

Yes, I set one-continuous algorithm on pieces of files. The error happens in standard libraries and is perfect in other place (most likely from - for already happened error which in any way did not show itself). Operation from files absolutely , as was, only now it is read by several flows simultaneously.

+ The algorithm long worked in multi-threaded a mode with DIFFERENT files. But as soon as I launched this algorithm with pieces of the same file there was an error.

10

Re: How different flows to read one text file?

We now sink in versions.
Can you will show a source code?

11

Re: How different flows to read one text file?

Better not a source code, and a simple code sample showing a problem.
PS You state that OS crookedly works for you, and it too a loud statement to do it without proofs.