Skip to content
ProcWriteToStdin

ProcWriteToStdin

Description

Write given raw data to stdin of child process.

Parameters

Name Direction Description
proc in Child process handle to write to.
buf in Pointer to Str object containing data to be written.

Success

Return number of bytes written.

Failure

Return -1

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    i32 ProcWriteToStdin(Proc *proc, Str *buf) {
        if (!proc || !buf) {
            LOG_FATAL("Invalid arguments");
            Str b_ = StrInit();                                                                                            \
            StrWriteFmt(&b_, __VA_ARGS__);                                                                                 \
            ProcWriteToStdin((p), &b_);                                                                                    \
            StrDeinit(&b_);                                                                                                \
        } while (0)
            StrWriteFmt(&b_, __VA_ARGS__);                                                                                 \
            StrPushBack(&b_, '\n');                                                                                        \
            ProcWriteToStdin((p), &b_);                                                                                    \
            StrDeinit(&b_);                                                                                                \
        } while (0)
            StrWriteFmt(&buf, "value = {}", 42);
            StrPushBack(&buf, '\n');
            ProcWriteToStdin(proc, &buf);
            StrDeinit(&buf);
        }
Last updated on