IPC via named pipe: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
m (→‎{{header|Wren}}: Minor tidy)
Line 578: Line 578:


This works fine on Ubuntu 20.04 and should work on other Linux distros though I can't vouch for anything else.
This works fine on Ubuntu 20.04 and should work on other Linux distros though I can't vouch for anything else.
<syntaxhighlight lang="ecmascript">/* ipc_via_named_pipe.wren */
<syntaxhighlight lang="wren">/* IPC_via_named_pipe.wren */


var InputFifo = "in"
var InputFifo = "in"
Line 634: Line 634:
<br>
<br>
We now embed this script in the following C program, build and run from one terminal.
We now embed this script in the following C program, build and run from one terminal.
<syntaxhighlight lang="c">/* gcc ipc_via_named_pipe.c -o ipc_via_named_pipe -lpthread -lwren -lm */
<syntaxhighlight lang="c">/* gcc IPC_via_named_pipe.c -o IPC_via_named_pipe -lpthread -lwren -lm */


#include <stdio.h>
#include <stdio.h>
Line 783: Line 783:
vm2 = wrenNewVM(&config);
vm2 = wrenNewVM(&config);
const char* module = "main";
const char* module = "main";
const char* fileName = "ipc_via_named_pipe.wren";
const char* fileName = "IPC_via_named_pipe.wren";
char *script = readFile(fileName);
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
WrenInterpretResult result = wrenInterpret(vm, module, script);