C++ has std::endl. Does anyone know of anything in C to use for this?
C++ has std::endl . Does anyone know of anything in C to use for
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
std::endlhas the effect of printing a newline'\n'character and then flushing the output stream.The C equivalent, if you’re printing to stdout, would be:
But in most cases the
fflushis unnecessary.Note that
std::endldoes not have the purpose of providing a platform-independent line ending. The character'\n'already is a platform-independent line ending. When written to a text stream, it will be translated to whatever line ending the platform uses (\r\nfor Windows, just\nfor Unix, etc.).