0

fgets adds in a trailing newline. Is there a suggested pattern to use which strips the newline?

int main(void)
{
    char book[50];
    puts("Enter the name of the book: ");
    fgets(book, 50, stdin);
    printf("The name of the book is: %s", book);
}
samuelbrody1249
  • 4,379
  • 1
  • 15
  • 58

0 Answers0