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

Recommended Answers

All 3 Replies

>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.

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

>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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.