There are basically 3 standard "streams"
- stdin - standard input stream
- stdout - standard output stream
- stderr - standard error stream
fprintf(standard stream, "message"); //message is sent to the mentioned stream
printf("message"); //message is sent to stdout. so it is as good as writing fprintf(stdout, "message")
#define BUFFER_SIZE 50
char *ch_arr = (char *)malloc(sizeof(char) * BUFFER_SIZE);
sprintf(ch_arr, "message"); //message is sent to char buffer whose pointer is passed as argument
printk(KERN_IMERG "message");
//used to print message to kernel log file. Hence it can only be called from kernel only
No comments:
Post a Comment