← Back to index

Ghost’s C library supplies the userspace runtime, allocation, standard I/O, strings, character handling, directory iteration and file-descriptor operations. It calls libapi for kernel services. Mathematical routines and selected support headers derive from musl.

#include <stdio.h>

FILE* file = fopen("/user/example.txt", "r");
if(file) {
    char line[128];
    while(fgets(line, sizeof(line), file))
        fputs(line, stdout);
    fclose(file);
}

Compatibility is partial rather than a complete C/POSIX environment. Rename and several calendar-time, locale and wide-character operations are unavailable or stubbed. Header availability does not imply that every declared function is supported; check the relevant implementation when porting software.