0

hi all,
i have a program that 'll take an Ip address from the user and 'll search this IP address in a file.
now i open this file in binary mode.
the IP address will be in this form 169.254.28.233
shall i convert this address into hex before searching? as i'm searching in a file in binary mode?

also i need a function or a sub program that do this conversion, in order to write the output clearly

2
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by Narue
0

>shall i convert this address into hex before searching?
Not unless you stored it as hex.

>as i'm searching in a file in binary mode?
This has nothing to do with hexadecimal.

0

i don't understand!!!!!!
now the user 'll give this ip address, then it'll be from the type string.
the binary file has unsigned char, how can i search this ip address.

then i need a function that do this conversion for another thing

0

>i don't understand!!!!!!
Obviously!

>now the user 'll give this ip address, then it'll be from the type string.
>the binary file has unsigned char, how can i search this ip address.
If it's in the form of a string, then read it back as a string and do a string comparison. What's so hard about this? The fact that you're using a binary oriented file is 100% irrelevant.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.