Write v0.1.0

Source
Writes bytes to a file descriptor.

Package: MacOS

Signature

func Write(fd: int32, buffer: *opaque, count: uint) -> int64;

Parameters

NameTypeDescription
fdint32File descriptor to write.
buffer*opaqueSource containing at least count bytes.
countuintNumber of bytes requested.

Returns

int64 - bytes written on success, or a negative errno value on failure. A successful call may write fewer than count bytes.

Example

import MacOS::{ StdOut, Write };

func Main() -> int {
    let text = "hello\n";
    let result = Write(StdOut, text.data, text.length);
    if result != text.length as int64 {
        return 1;
    }
    return 0;
}

See also

  • MacOS — the package overview
  • Read - read bytes