xt_dprintf(3)

NAME
xt_dprintf() - Print formatted output to a low-level file descriptor

LIBRARY
#include <xtend/file.h>
-lxtend

SYNOPSIS
int     xt_dprintf(int fd, const char * restrict format, ...)

ARGUMENTS
fd      File descriptor to which items are written
format  printf-style format string

DESCRIPTION
The dprintf() function, which takes a file descriptor rather than a FILE stream pointer, is provided by many systems including BSDs and Linux, but not by all. Use of xt_dprintf() from libxtend will ensure portability of code.

RETURN VALUES
The number of items written

EXAMPLES
int     fd;
if ( (fd = open(filename, O_WRONLY|O_CREAT)) != -1 )
{
    xt_dprintf(fd, "fd = %dn", fd);
    ...
    close(fd);
}

SEE ALSO
fprintf(3)