Friday, June 25, 2010

C printing question

Question :
Is there a way to print anything through a C program without using
in-built functions like
puts,printf etc.?

Answer :
stdout is a stdio function, It is a FILE *, you don't use it with
write() and also, it may be a valid assumption that if you are using
write() at all for standard output, you don't even have stdio in your

You asked for non-library methods.

write(STDOUT_FILENO, "abc\n", 4);

STDOUT is defined as the handle 1 so if you don't have it declared,
just use 1 on most systems.

No comments:

Blog Archive