Com 212 intro to system programming book Theory



Download 0.65 Mb.
View original pdf
Page47/72
Date13.05.2021
Size0.65 Mb.
#56617
1   ...   43   44   45   46   47   48   49   50   ...   72
com-212-introduction-to-system-programming-theory
9833 SS1 FISHERY LESSON NOTE

WEEK NINE

Learning Outcome for this week Describe error checking and handling Explain utilities and give some examples Discuss the types of libraries

ERROR CHECKING
One of the major differences between systems programming and application programming is that error checking is not something nice to have but so essential that one cannot live without. Very commonly, you can see people do "printf" to output error messages to the console. Although better than not having any error checking, however, this is not enough even when not doing systems programming. NOTE WE SHALL BASED OUR EXAMPLES HEREON C PROGRAMMING LANGUAGE When each program runs and becomes a process, there are three files opened for it by default,
stdin, stdout and stderr. The first two obviously are the input and output consoles and the third,
stderr, is where the error messages are supposed to go to. stdin and stdout maybe redirected, while stderr cannot. Therefore the error messages are best output using fprintf(stderr,"your error message It should also be known to you that printf and fprintf(stdout,"...") do the same task. Besides using fprintf, there are two other important tools for use in error checking perror and

Download 0.65 Mb.

Share with your friends:
1   ...   43   44   45   46   47   48   49   50   ...   72




The database is protected by copyright ©ininet.org 2024
send message

    Main page