Why fgets() in cpp not terminate on enter key | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why fgets() in cpp not terminate on enter key

This is code related to remove punctuation marks From string. https://code.sololearn.com/cGtsgm3MsFI0/?ref=app

31st Jul 2021, 4:55 AM
Gaurav Prajapati
Gaurav Prajapati - avatar
2 Answers
+ 2
Gaurav, Why are you using char[] and fgets() in C++? why not use std::string and std::getline()? char[] and fgets() are for C codes bro.
31st Jul 2021, 5:19 AM
Ipang
0
But why fgeta() not terminating on the '\0' (null) character. When i am enter, enter key then also it keep taking value. Pls help me... https://code.sololearn.com/cGtsgm3MsFI0/?ref=app
1st Aug 2021, 2:57 PM
Gaurav Prajapati
Gaurav Prajapati - avatar