I am trying to to record response by the user(using `getchar()`). I am having issues with `'\n'` sticking in buffer. If I use `fgets(char* buf, .. , ..)`, `'\n'` again goes into `buf` and you have to include `'\n'` at the end of the test string. when using string.h functions (like `strcmp()`). Is there any clean way of writing code for such purposes. 

```
    #include<stdio.h>
    #include<string.h>
    int main()
    {
    char buf[100];
    fgets(buf, 3, stdin);
    puts(buf);
    int i = strcmp("p\n", buf);
    printf("%d", i);
    //if (!strcmp("CLock to random\n", buf))
    //{
    //puts("sucess");
    //}
    char c;
    c = getchar();
    putchar(c);
    return 0;
    }

```

Now I want to record response(single character 'p'). If I use getchar(), in place of fgets(), program skips second getchar()( c = '\n'). If I use the current code, i have to include \n in strcmp() every time.