I want to write some small program that is getting strings from the user(using console) when max input is 100 characters , and when user pressed enter - it will copy the input to some file. I want to exit the loop when user enters the string "exit"
for example : "hi how are you?" " bla bla" "exit" I just don't get how to make it work - should I use scanf? getchar? fgets?
char* buf ;
int i;
 buf = (char*)calloc(100, sizeof(char));
 while(1) 
  {
     fgets(s, sizeof(s), stdin);
     if (strcmp(s , "exit") == 0)
       break;
     else
   ...write to file...
   }
do I need manually put "\0" ?
thanks!
 
     
     
    