This should be SO easy yet I can't figure it out. I'm doing:
#include <QFile>
#include <QString>
#include <QTextStream>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <QtCore>
#include <QChar>
QFile filein(filename);
if(filein.open(QFile::ReadWrite | QFile::Text)){
QTextStream in(&filein);
QString line = in.readLine();
_n = QChar::digitValue(line[0]);
_m = stoi(line[1]);
}
Neither of these work: stoi
is not defined
, no matter what I include, even though I am using a C++11 compiler, also:
cpp:36: error: no matching function for call to 'QChar::digitValue(QCharRef)'
_n = QChar::digitValue(line[0]);
^`
so that doesn't work either. I also tried QChar::unicode()
with similar results. What am I missing?
看起来像你想要的
int _n = line[0].digitValue();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.