fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. const char *getWord(FILE *fp,char word[],size_t wordsize)
  5. {
  6. size_t size=0;
  7. int ch;
  8. while((size+1<wordsize)&&(isalpha(ch=fgetc(fp)))) word[size++]=ch;
  9. word[size]=0;
  10. return size?word:NULL;
  11. }
  12.  
  13. int main()
  14. {
  15. char word[65];
  16. while(!feof(stdin)) if(getWord(stdin,word,65)) printf("'%s'\n",word);
  17. return 0;
  18. }
Success #stdin #stdout 0s 2116KB
stdin
czesc siema 
hey
jestem tutaj
stdout
'czesc'
'siema'
'hey'
'jestem'
'tutaj'