On Tuesday 05 April 2005 4:42 pm, Michele Noberasco wrote: > On Tue, 05 Apr 2005 08:56:04 -0400 [....] > #define _GNU_SOURCE > > #include <stdio.h> > #include <stdlib.h>
#include <sysexits.h> > int main(int argc, char *argv[]) > { > FILE *out; > size_t len = 0; > char *line = NULL; > > out = fopen("/tmp/output.txt", "w"); > if (!out) abort(); you shall this instead (as mentioned in the postfix docs): if (!out) return EX_CANTCREAT; The file <sysexits.h> defines lots of standard software error codes. > while (getline(&line, &len, stdin) != -1) > fprintf(out, "%s", line); hmm... I'm not complaining, it's your code. But this one would be better AFAIK write(fileno(out), line, len); > return EXIT_SUCCESS; For some reason, they provide EX_OK in the include file I mentioned above. > Bye > Michele Noberasco Finally, just one question (I'm curious ;). Why did you switch from C++ to C? (with regard to your provided sources) Regards, Christian Parpart. -- Netiquette: http://www.ietf.org/rfc/rfc1855.txt 17:34:57 up 13 days, 6:41, 1 user, load average: 0.50, 0.57, 0.53
pgpuw13Zr411U.pgp
Description: PGP signature