Reputation: 13
I tried to compare 2 IP Addresses stored in 2 character arrays. I get the first IP Add char array from socket and the second 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?
Upvotes: 0
Views: 590
Reputation: 41080
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?
Upvotes: 3