![]() |
![]() ![]() ![]() ![]() ![]() |
Debugging Your Application - 1
- Add printf() statements in your code
- - use #ifdef DEBUG compile directive
- Add perror() statements in your code
- - use #ifdef PRINT_ERROR compile directive
if ( (fd = open(pathname, O_RDWR)) < 0) { /* errno already set by open() */ #if defined(DEBUG) || defined(PRINT_ERROR) sprintf(msg, "functionX(): open(%s, O_RDWR)", pathname); perror(msg); #endif return -1; }