How to input characters until Ctrl+C is pressed in C

1 Answer

0 votes
#include <stdio.h>
   
int main(int argc, char **argv) 
{ 
    char ch;
     
    while ((ch = getchar()) != EOF);

    return 0;
}

/*
  
run:
   
hagsd fahsf
asdj h asdgf asd


*/

 



answered Oct 4, 2015 by avibootz
edited Oct 4, 2015 by avibootz
...