#include "../include/syscalls.h" #define STDOUT 1 unsigned strlen(const char* str) { unsigned len = 0; while (*str) { ++len; ++str; } return len; } void main() { const char* path = "/qwerty.txt"; const char* msg = "Suki Suki Daisuki Kekkon Shiyo, my honey!"; char buf[128]; // ── open file ───────────────────────────── long fd = syscall(SYS_OPEN, (long)path, 0, 0); // ── write message ───────────────────────── syscall(SYS_WRITE, fd, (long)msg, strlen(msg)); // ── close ──────────────────────────────── syscall(SYS_CLOSE, fd, 0, 0); // ── reopen ─────────────────────────────── fd = syscall(SYS_OPEN, (long)path, 0, 0); // ── read into buffer ───────────────────── long n = syscall(SYS_READ, fd, (long)buf, sizeof(buf)); // ── close ──────────────────────────────── syscall(SYS_CLOSE, fd, 0, 0); // ── print buffer to stdout ─────────────── syscall(SYS_WRITE, STDOUT, (long)buf, n); // ── done ──────────────────────────────── while (1); }