25 lines
468 B
C
25 lines
468 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/syscall.h>
|
|
#include <sys/sysmacros.h>
|
|
#include <unistd.h>
|
|
|
|
int main()
|
|
{
|
|
printf("Hello world!\n");
|
|
|
|
mkdir("/dev", 0755);
|
|
if (mknod("/dev/console", 0666, makedev(1, 0)) < 0)
|
|
{
|
|
perror("mknod");
|
|
return 1;
|
|
}
|
|
|
|
const char* str = "Hello from /dev!";
|
|
|
|
FILE* f = fopen("/dev/console", "r+");
|
|
if (f) fwrite(str, 1, strlen(str), f);
|
|
if (f) fclose(f);
|
|
}
|