0
Why fprintf with stderr ??
Hi! I'm unable to understand why I will use: fprintf(stderr, "Error: %s", strerror(errno)); When I can use: printf("Error: %s", strerror(errno)); And perror("Error"); Can anyone explain? I don't think I have to use fprintf. And can I do something about user defined function that it's error can be printed by "perror()". I mean I want to make a custom error that can be used by strerror(errno) or perror()
4 Respostas
+ 2
you're not mandatory to output error message to stderr rather than stdout (default output for printf), but you are strongly advised to do so, to separate normal output from error output: this let user filter output of your program by stream ;)
+ 1
no, because I'm not aware of how error handling is done in C... :(
0
visph
Can you help me with my second question
0
visph
Ok Thanks 😊