Question: I know I can get the first character of a line of standard input by using getchar(), but I *only* want the first character of each line. Is there a function I can use to get rid of the rest of the string entered into standard input (if it is more than one character)? if not, what methodology should I consider using to get rid of the rest of the standard input line?

Answer: 
```
char buf[100];
while(fgets(buf,sizeof(buf),stdin) != NULL)
{
   if(strlen(buf)>0)
      buf[1] = '\0';
   printf("%s",buf);
}

```

Read the whole line using `fgets()` and just nul terminate it after the first character.
```
#include <stdio.h>

int main(void)
{
int ch;
size_t len;

for (len = 0;   1;      ) {
        ch = getc(stdin);
        if (ch == EOF) break;
        if (!len++) putc(ch, stdout); /* the first character on a line */
        if (ch == '\n') len = 0;        /* the line has ended */
        }
return 0;
}

```

Please note that the first character on a line can actually be a `'\n'` !!!