TetaTricks/code/C/fgets-simple.c

15 lines
260 B
C
Raw Normal View History

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