How to find "\r" in a conditional?

Posted by Werner on Stack Overflow See other posts from Stack Overflow or by Werner
Published on 2010-03-27T15:27:11Z Indexed on 2010/03/27 15:33 UTC
Read the original article Hit count: 151

Filed under:

Hi,

in a C++ program some string reads info from file, and in some part contains a "\r" character. I need to remove it, afte the read, in order to avoid problems. I thought about comparing strings character to character, I thought that "\r" would take two chars, but not, it is just one. how would i use a conditional ? if char[4]==`\r' ???

Thanks

P.D. How would the problem be solved in C?

© Stack Overflow or respective owner

Related posts about c++