I tried to compare 2 IP Addresses stored in 2 character arrays. I get the first IP Add char array from socket and the seco开发者_JS百科nd IP Add char array from text file. When I use strcmp function, I got a non-zero value(which means 2 strings are not equal) although when I tried to printf on the screen , they are equal. Any idea about my prob?
Probably the problem is a special character like '\n', '\r', ... in your char array (from text file). Try to delete them ;-)
How to remove a carriage return from a string in C?
精彩评论