Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. #include <QCoreApplication>
  2. #include <QString>
  3. #include <QFile>
  4. #include <QDebug>
  5. #include <QStringList>
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9.    QCoreApplication a(argc, argv);
  10.    QFile file("/etc/passwd");
  11.        if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
  12.        {
  13.            qDebug() <<  "Cannot open a file";
  14.        }
  15.        QString line;
  16.        QString array[100];
  17.        int i = 0;
  18.        QTextStream in(&file);
  19.        while (!in.atEnd())
  20.        {
  21.            in >> line;
  22.            array[i] = line;
  23.            QStringList lst = line.split(":");
  24.            qDebug() <<  lst[2] << lst[0];
  25.            i++;
  26.        }
  27.        
  28.        
  29.        
  30.        
  31.       //тут у нас хрень! мы не знаем как нам считать простяцки данные из utmp
  32.        utmpname(_PATH_WTMP); // Указываем, что используем историю (wtmp)
  33.        struct utmp *ut; // Готовим переменную типа utmp
  34.        ut = getutent();
  35.  
  36.    return a.exec();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement