Programming and posix - February 2001

February 10, 2001
Solution Symposium
Page 63
hp e3000
programming
and posix
debugging your application - 1
Add printf() statements in your code
use #ifdef DEBUG compile directive
Add perror() statements in your code
use #ifdef DEBUG compile directive
if ( (fd = open(pathname, O_RDWR)) < 0)
{
/* errno already set by open() */
#ifdef DEBUG
sprintf(msg, "functionX(): open(%s,
O_RDWR), pathname);
perror(msg);
#endif
return -1;
}