This commit is contained in:
tTh 2023-09-01 11:06:31 +02:00
parent bfef02de49
commit db14adeb86

View File

@ -1,14 +1,14 @@
/* /*
* exemple utilisation 'fgets' * exemple d'utilisation de 'fgets'
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#define TL 8 #define TL 12
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
char buffer[TL+1]; char buffer[TL+1];
while( fgets(buffer, TL, stdin) ) { while( fgets(buffer, TL, stdin) ) {
printf(" %4ld\n", strlen(buffer)); printf(" %4ld %s\n", strlen(buffer), buffer);
} }
return 0; return 0;
} }