D
D
dmitriy_domaskin2018-11-23 07:53:15
Qt
dmitriy_domaskin, 2018-11-23 07:53:15

How to write and read a 2D bool array using QTextStream from a file?

The >> and << operators need to be defined.
How am I trying to write

.....
stream << dataArrays;
.....

static QTextStream& operator << (QTextStream& stream, const BoolModel mData[4])
{
    for(int k = 0; k < 4; k++)
    {
        auto data = mData[k].data();
        stream << "\n";
        for(int i = 0; i < (int)data.size(); i++)
            for (int j = 0; j < (int)data[0].size(); j++)
            {
                stream << data[i][j] << " "; // где data[i][j] - значение bool
            }
        stream << "\n";
    }
    return stream;
}

As a result, something like "0x7fffea105c80" falls into the file, not sure if this is correct.
Reading is really bad, help me figure it out

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question