diff --git a/newlib/examples/hello.c b/newlib/examples/hello.c index f65ce176..5f730b45 100644 --- a/newlib/examples/hello.c +++ b/newlib/examples/hello.c @@ -22,11 +22,36 @@ #include #include #include -#undef errno -extern int errno; + +/*file descriptor init*/ +#define NR_OPEN 10 +#define FS_INIT { [0 ... NR_OPEN-1] = {NULL, 0, 0} } + +/*open flags*/ + +//#define O_RDONLY 0 +//#define O_WRONLY 1 +#define O_RDWR 2 + +#define O_CREAT 64 +#define O_EXCL 128 +//#define O_NOCTTY 256 +#define O_TRUNC 512 +#define O_APPEND 1024 + int main(int argc, char** argv) { - printf("test!"); + char* teststr = malloc(sizeof(char)*100); + int testfile = open("/bin/test", O_APPEND, "wr"); + write(testfile, "test", 4); + lseek(testfile, 0, SEEK_SET); + read(testfile, teststr, 100); + printf("Gelesen aus neuer Datei: %s", teststr); + + + + + return errno; }