D
D
Dmitry Popov2018-03-20 16:35:55
C++ / C#
Dmitry Popov, 2018-03-20 16:35:55

2 streams in one file?

We need to reorganize a binary file containing a matrix of numbers, leaving only rows with a "suitable" first element, using 2 streams to this file - one for reading, one for writing. How to implement it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Adamos, 2018-03-20
@DigitalLev

fstream file;
file.open("myfile.txt", ios::in|ios::out);

A
Alexander Ananiev, 2018-03-20
@SaNNy32

1. Create a stream, open the file for reading in it and read the contents into memory, close the file.
2. Create a second stream, open a file in it for writing, take the read data from memory and, in accordance with the necessary conditions, write the data to the file, then close the file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question