![]() |
In code C, How can I erase special characters from a char array?
I have this code:
Code:
int readConfig(char *IP, int *p, char Myfile[]){5555 Well, when I print the IP value, this is the result IP: 255.255.255.255fhv��� How can I do for fix it??? I want that only print: IP: 255.255.255.255 Thanks!!!! |
Re: In code C, How can I erase special characters from a char array?
Because your 5555 is converted into ASCII as that character.
|
Re: In code C, How can I erase special characters from a char array?
> Well, when I print the IP value, this is the result
> IP: 255.255.255.255fhv��� You don't append a \0 to the string you build up, so you get a random amount of trailing junk until the print function just happens to find a \0. Also, your c variable should be an int if you want to compare it with EOF properly. Consider this loop a simplification (and safer). Code:
int c; |
| All times are GMT +5.5. The time now is 14:34. |