Working through usages of all I/O functions whil in chapter 25
This commit is contained in:
parent
340b1f207d
commit
912eb6a143
19
ex24_iofunctions.c
Normal file
19
ex24_iofunctions.c
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "dbg.h"
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
printf("Reading from stdin: <a:number> <b:number> <c:letter>\n");
|
||||||
|
int a, b, rc;
|
||||||
|
char c;
|
||||||
|
rc = fscanf(stdin, "%d %d %c", &a, &b, &c);
|
||||||
|
check(rc == 3, "Failed to read from stdin.");
|
||||||
|
|
||||||
|
printf("Read in: a=%d b=%d c=%c\n", a, b, c);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return 1;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user