C/output for a c program
Expert: Narendra - 8/24/2005
Questionthanks
but write() is used to write strings in a file.
how can i use it to print integer numbers in the computer screen(it has to be faster than printf()function).?
again similarly if there is faster process to take input of integer numbers than using scanf() function.?
-------------------------
Followup To
Question -
can u give another faster techniques to give output of integers instead of using printf() function?
Answer -
Use write() system call.
Answerprintf() is just a wrapper around the write() system call.
If you are on Linux or Unix, then you can get the man page of write() on your terminal.
If you are on windows, I don't know the system call used there.
Actually, write() can be used to write to any device, including your desktop terminal. Also, it can be used to write data to a file.
Where it writes, depends on the file descriptor that you give.
If you give STDOUT, then it will write to terminal.
All these make use of the underlying device driver for all their work.
So, if you want to be faster than the current implementation, then you will have to write your own device driver and use it.
Hope this clears.
-Narendra