user3540983
user3540983

Reputation: 141

How can I read character by character from a text file in QT C++?

I want to read from a text file like simple C++'s fgetc but with QT QTextStream where I tried readall method but it skip the last characther which probably is a break.

Upvotes: 0

Views: 3795

Answers (1)

DvoryankinEvgeny
DvoryankinEvgeny

Reputation: 128

You can use read method and set max number of characters for reading.

    QString oneChar = stream.read(1);

or can use overload operator >> for QChar. Something like this

    QChar oneChar = '';
    stream >> oneChar;

Upvotes: 1

Related Questions