Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Does fgets() read past a leading newline?
/* Does fgets() read past a leading newline? */ #include <stdio.h> int main(void) { enum { bufsiz = 1024 }; char buf[bufsiz] = { 0 }; int n = 0; /* Using "%d" instead would consume trailing whitespace. */ if (scanf("%d", &n) == 1) { printf("scanf() read %d.\n", n); } else { puts("scanf() couldn't read a number."); } putchar('\n'); if (fgets(buf, bufsiz, stdin) != NULL) { printf("fgets() read: [%s]\n", buf); } else { puts("fgets() couldn't read a line."); } return 0; }
run
|
edit
|
history
|
help
0
lab7_OOP 0.2 beta
Bit string printer
Herout (67) - 15
ejemplos bucles basicos
strchr
Herout (67) - 8+9
Cvičenie -č.6-UDP
Bucles: Rombo asimetrico
Ashar
0003