mirror of
https://gitlab.com/niansa/libhss.git
synced 2025-03-06 20:49:21 +01:00
Updated example to make use of Bidirectional IPC
This commit is contained in:
parent
21fb69b630
commit
972526e88b
2 changed files with 4 additions and 2 deletions
|
@ -9,8 +9,9 @@ void entry(QBiIPC& ipc) {
|
|||
ipc.send("Hello world!");
|
||||
ipc.send_raw(size_t(1234567890));
|
||||
|
||||
ipc.send("Trying to open file: /etc/passwd");
|
||||
std::ifstream f("/etc/passwd");
|
||||
auto fname = ipc.recv();
|
||||
ipc.send("Trying to open file: "+fname);
|
||||
std::ifstream f(fname);
|
||||
if (f.fail()) {
|
||||
ipc.send(std::string("Failed: ")+strerror(errno));
|
||||
} else {
|
||||
|
|
|
@ -13,6 +13,7 @@ int main() {
|
|||
|
||||
std::cout << ipc.recv() << std::endl
|
||||
<< ipc.recv_raw<size_t>() << std::endl;
|
||||
ipc.send("/etc/passwd");
|
||||
for (std::string line = ""; line != "End."; line = ipc.recv()) {
|
||||
if (!line.empty()) {
|
||||
std::cout << line << std::endl;
|
||||
|
|
Loading…
Add table
Reference in a new issue