Changeset 63088cc1 in mainline for uspace/app/tester/stdio/stdio1.c


Ignore:
Timestamp:
2008-12-29T13:30:19Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1c1002a
Parents:
04b687b
Message:

fgetc(), fputc(), fputs(), fseek().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/stdio/stdio1.c

    r04b687b r63088cc1  
    4040        char *file_name = "/readme";
    4141        size_t n;
     42        int c;
    4243
    4344        printf("Open file '%s'\n", file_name);
     
    6162        printf("Read string '%s'.\n", buf);
    6263
    63         fclose(f);
     64        printf("Seek to beginning.\n");
     65        if (fseek(f, 0, SEEK_SET) != 0) {
     66                fclose(f);
     67                return "Failed seeking.";
     68        }
     69
     70        printf("Read using fgetc().\n");
     71        while (true) {
     72                c = fgetc(f);
     73                if (c == EOF) break;
     74
     75                printf("'%c'", c);
     76        }
     77
     78        printf("[EOF]\n");
     79        printf("Closing.\n");
     80
     81        if (fclose(f) != 0)
     82                return "Failed closing.";
    6483
    6584        return NULL;
Note: See TracChangeset for help on using the changeset viewer.