Programming and posix - April 2002
April 3, 2002
Solution Symposium
Page 64
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;
}