Re: stream io in c



On Thu, 31 Jul 2008 15:04:37 +0530, santosh posted:

// gcc -o chars mkchars2.c

This command is not a conforming implementation of ISO C. For that you
need:

gcc -ansi -pedantic /* For conformance to C90 */
gcc -std=c99 -pedantic /* For incomplete but good conformance to C99
*/

Also add the -Wall and -W flags for extra diagnostics which are always a
help.

//mkchars.c:



#include <stdio.h>
#include <stdlib.h>

int main(void)
{
FILE *fp;
char name[]="text62.txt";


int c;

if ((fp = fopen(name, "wb")) == NULL)
{
printf("can't open %s\n", fp);
return EXIT_FAILURE;
}
else
{
for (c = 0; c <= 255; c ++) {
putc(c, fp);
}
fclose(fp);
}
return 0;
}
// gcc -o chars -std=c99 -pedantic mkchars3.c

--
When a new source of taxation is found it never means, in practice, that
the old source is abandoned. It merely means that the politicians have two
ways of milking the taxpayer where they had one before. 8
H. L. Mencken
.



Relevant Pages

  • Re: stream io in c
    ... This command is not a conforming implementation of ISO C. ... Also add the -Wall and -W flags for extra diagnostics which are always a ... int main ... both versions and compare them myself. ...
    (comp.lang.c)
  • Re: stream io in c
    ... Also add the -Wall and -W flags for extra diagnostics which are ... int main ... Can you spot the mistake in this printf call? ... If you had added the -Wall and -W flags to gcc, ...
    (comp.lang.c)
  • [PATCH] riscom8: Coding style
    ... unsigned long flags; ... unsigned char val1, val2; ... struct riscom_port *port; ...
    (Linux-Kernel)
  • perfmon3 interface overview
    ... words redesign of the perfmon2 syscall API. ... Each syscall has a flags parameters which allows the syscalls to be ... int pfm_create_session; ... It is located in the perfmon3 branch. ...
    (Linux-Kernel)
  • [PATCH 03/18] flag parameters: paccept
    ... This syscall differs from accept in that it adds ... The flags parameter can be used to set flag like SOCK_CLOEXEC. ... we really want the signal mask ... handler (int s) ...
    (Linux-Kernel)