Changeset 01cc7b4 in mainline for uspace/lib/c/generic/stdio/scanf.c


Ignore:
Timestamp:
2018-06-13T10:59:47Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f47a905
Parents:
ed18e14
git-author:
Jiri Svoboda <jiri@…> (2018-06-11 18:54:14)
git-committer:
Jiri Svoboda <jiri@…> (2018-06-13 10:59:47)
Message:

Implement sscanf via virtualizing FILE and implementing string backend for FILE.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/stdio/scanf.c

    red18e14 r01cc7b4  
    4646#include <stdio.h>
    4747#include <stdlib.h>
     48#include "../private/stdio.h"
     49#include "../private/sstream.h"
    4850
    4951typedef enum {
     
    13381340{
    13391341        va_list args;
    1340         FILE *f;
     1342        FILE f;
    13411343        int rc;
    13421344
    1343         f = fopen("/tmp/test.tmp", "wt");
    1344         if (f == NULL)
    1345                 return EOF;
    1346 
    1347         if (fputs(s, f) == EOF)
    1348                 return EOF;
    1349 
    1350         if (fclose(f) == EOF)
    1351                 return EOF;
    1352 
    1353         f = fopen("/tmp/test.tmp", "rt");
    1354         if (f == NULL) {
    1355                 printf("failed to open for reading\n");
    1356                 return EOF;
    1357         }
     1345        __sstream_init(s, &f);
    13581346
    13591347        va_start(args, fmt);
    1360         rc = xxvfscanf(f, fmt, args);
     1348        rc = xxvfscanf(&f, fmt, args);
    13611349        va_end(args);
    13621350
    1363         fclose(f);
    1364 
    13651351        return rc;
    13661352}
Note: See TracChangeset for help on using the changeset viewer.