-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqunix.cc
More file actions
37 lines (30 loc) · 958 Bytes
/
qunix.cc
File metadata and controls
37 lines (30 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "qunix-string.h"
#include "qunix-unistd.h"
int main(void)
{
auto file(qunix_file::dup(0));
if(file && file->isOpen())
qDebug() << QObject::tr("File (%1) is now open.").arg(file->handle());
else
qDebug() << QObject::tr("Cannot open file.");
qDebug() << "ENOMEM:" << qunix_string::strerror_r(ENOMEM);
qDebug() << qunix_unistd::chdir(nullptr);
qDebug() << qunix_unistd::getgroups();
qDebug() << qunix_unistd::getgroups_names();
qDebug() << qunix_unistd::gethostname();
qDebug() << qunix_unistd::getlogin_r();
qDebug() << static_cast<int>
(qunix_unistd::FCHOWNAT_FLAGS::AtEmptyPath |
qunix_unistd::FCHOWNAT_FLAGS::AtSymlinkNoFollow);
qDebug() << (AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW);
QByteArray a(10, '\0');
a[0] = 0x00;
a[1] = 0x01;
a[2] = 0x02;
a[3] = 0x03;
a[4] = 0x04;
QByteArray b(5, '\0');
qDebug() << "swab:" << qunix_unistd::swab(a, b, 5);
qDebug() << b;
return EXIT_SUCCESS;
}