473,387 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

forming an ipaddress string from unsigned char array

Hi,
How can I convert a unsigned char array1 which holds the ipaddress,
into a string

I am using a char array to insert the '.' between the bytes.
I am using a char array because then I can convert it into a string
string address(array);
but when i store it in this way when I store 192 in the char array it
stores "-65"

Is there function like getByAddress() in C++.I am used java,but
recently I changed to c++

BTW this is not some sort of homework.I am too old for that :)
Mar 24 '08 #1
0 1591

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Timo | last post by:
I am trying to get address of myStruct to a string array texts. I am using M$ Visual C++ 6.0 (this is not OS specific question, though, this code should also work on 16 bit embedded compiler ;)). ...
7
by: techno | last post by:
Dear all, Our bitmap has some x00 values ( '\0' ) and i am storing it in char* array. the problem is that the '\0' is treated as eos character in c and it is truncating it so the characters...
23
by: Nascimento | last post by:
Hello, How to I do to return a string as a result of a function. I wrote the following function: char prt_tralha(int num) { int i; char tralha;
5
by: Stuart Norris | last post by:
Dear Readers, I am attempting to define an array of IPAddress-es in C#. I wish to have a array of address so I can try in order to connect to them in a loop to handle unavailable hosts. ...
10
by: sposes | last post by:
Im very much a newbie but perhaps somehone can help me. Ive been searching for a way to convert a std::string to a unsigned char* The situation is I have a function that wants a unsigned char*...
13
by: bwaichu | last post by:
Now, I read the faq, and it suggests using sprintf. However, I want to all ways know where the integer finishes in the string. Basically, I want to: nbr | other data But the other data all...
6
by: Andrea | last post by:
Hi, suppose that I have a string that is an hexadecimal number, in order to print this string I have to do: void print_hex(unsigned char *bs, unsigned int n){ int i; for (i=0;i<n;i++){...
2
by: sam.barker0 | last post by:
Hi , I am trying to convert from an IPADDRESS string to a unsigned char array I tried to use c_str().Its was stupid because I tried to cast it with <unsigned int. Is there a way easily do...
5
by: sam.barker0 | last post by:
Hi, How can I convert an unsigned char array containing IPV6 address into a string Eg if arrray contains 20 01 05 03 a8 3e 00 00 00 00 00 00 00 02 00 30 Then the address is Addr:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.