A: 

Why would you want to do that?

Rolf Anders
Wow, a bit touchy, eh?
Ed Swangren
@Manoj: Uhh.. Might want to watch those typos a bit closer. "i fu" instead of "if u"? Oops! ;)
Jonathan Lonowski
thank u Jonathan
Manoj Doubts
+5  A: 

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.

Johannes Schaub - litb
Hate to to you, that's a library function. Most likely in your C library.
derobert
ok then in windows if anybody knows how to do it please help.well for ur note this is not a homework question. I was trying to do it for some simple parser
Manoj Doubts
`objdump -T /lib/libc.so.6 | grep syscall` informs me that `syscall` is still a library function :-D
derobert
+11  A: 

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.

derobert
yeah thank u i wanted to do some thing similar to thatthank u very much if u have any more resources for that please send me thank u
Manoj Doubts
'plz send the codez' is not what SO is about.
Adriano Varoli Piazza
+2  A: 
Manoj Doubts
@Manoj Doubts: How does this program work? Specifically, what is `0xB8000000L` and how does one arrive at it?
Lazer
A: 

0xB8000000L. Actually this is the memory address of the device Display memory. Imagine an array of 4000 memory block.