Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QCoreApplication>
- #include <QString>
- #include <QFile>
- #include <QDebug>
- #include <QStringList>
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- QFile file("/etc/passwd");
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
- {
- qDebug() << "Cannot open a file";
- }
- QString line;
- QString array[100];
- int i = 0;
- QTextStream in(&file);
- while (!in.atEnd())
- {
- in >> line;
- array[i] = line;
- QStringList lst = line.split(":");
- qDebug() << lst[2] << lst[0];
- i++;
- }
- //тут у нас хрень! мы не знаем как нам считать простяцки данные из utmp
- utmpname(_PATH_WTMP); // Указываем, что используем историю (wtmp)
- struct utmp *ut; // Готовим переменную типа utmp
- ut = getutent();
- return a.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement