TetaTricks/code/C/fgets-simple.c

15 lines
260 B
C
Raw Normal View History

2023-07-15 18:55:13 +11:00
/*
2023-09-01 20:06:31 +11:00
* exemple d'utilisation de 'fgets'
2023-07-15 18:55:13 +11:00
*/
#include <stdio.h>
#include <string.h>
2023-09-01 20:06:31 +11:00
#define TL 12
2023-07-15 18:55:13 +11:00
int main(int argc, char *argv[])
{
char buffer[TL+1];
while( fgets(buffer, TL, stdin) ) {
2023-09-01 20:06:31 +11:00
printf(" %4ld %s\n", strlen(buffer), buffer);
2023-07-15 18:55:13 +11:00
}
return 0;
}