Why would you want to do that?
In linux, you can use the write
system-call:
write(1, "hello\n", 6); // write hello\n to stdout
If you can't get enough of it, you can go one step lower, invoking the syscall generically:
syscall(__NR_write, 1, "hello\n", 6);
It's worth knowing about strace
, which you can use to see which syscalls are used by any particular program while it runs. But note that for "some simple parser", it's hardly needed to use raw system calls. Better use the functions of the c library.
By the way, lookout for WriteFile and GetStdHandle functions if you want to do the above in Windows without using the c standard library. Won't be as l33t as the linux solution though.
In standard C, you can't. The only I/O defined in C is through the C standard library functions.
On a given platform, there may be ways to do it:
- Make kernel calls directly. You will probably need to write some inline assembly to do this. You could make litb's
write
call directly, without using your C library. Grab the source of your C library to see how it's done. - Write directly to the frame buffer. Multi-user OS's often disallow this (at least without making any library/kernel calls).
Unless you're writing your own C library, I'm not sure why you'd want to do this.