Annotation of coherent/d/usr/src/examples/fputc.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: 
        !             3: main()
        !             4: {
        !             5:        FILE *fp, *fout;
        !             6:        int ch;
        !             7:        int infile[20];
        !             8:        int outfile[20];
        !             9: 
        !            10:        printf("Enter name to copy: ");
        !            11:        gets(infile);
        !            12:        printf("Enter name of new file: ");
        !            13:        gets(outfile);
        !            14: 
        !            15:        if ((fp = fopen(infile,"r")) != NULL) {
        !            16:                if ((fout = fopen(outfile,"w")) != NULL) 
        !            17:                        while ((ch = fgetc(fp)) != EOF) 
        !            18:                                fputc(ch, fout);
        !            19:                else
        !            20:                        printf("Cannot write %s.\n", outfile);
        !            21:        } else
        !            22:                printf("Cannot read %s.\n", infile);
        !            23: }
        !            24: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.