Re: [Dev-C++] initializing string with memory buffer
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: hhh h. <the...@ho...> - 2008-09-17 06:08:02
|
Well, if I got your message right, I guess this will help you... http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#ipaddr And please note, the IP 1.2.3.4 is converted to a 4-byte value, in Big Endian, using this functions... > From: ll...@cd... > To: pw...@ia...; dev...@li... > Date: Tue, 16 Sep 2008 09:39:01 +0530 > Subject: Re: [Dev-C++] initializing string with memory buffer > > I think my explanation was not clear.I was not talking about the memory > representation of "1.2.3.4", but how the system will store IP. The > system stores an IP address in 4bytes.(As in IPv4 header). I want to > make the string representation of this 4bytes. Think now I made it > clear. > > Thanks, > Lloyd > > On Mon, 2008-09-15 at 22:20 +0200, Per Westermark wrote: > > That is not a string. > > > > A string representation of the IP number should have "1.2.3.4" or in > > binary: > > 0x31 > > 0x2e > > 0x32 > > 0x2e > > 0x33 > > 0x2e > > 0x34 > > 0x00 > > > > /pwm > > > > On Mon, 15 Sep 2008, Lloyd wrote: > > > > > Hi, > > > > > > I am using C++ STL string. I have an IP address something like 1.2.3.4 > > > So its memory will be 0x01020304. I want to initialise a string with > > > this memory. How can I do this? > > > > > > > > > > > > int ip=0x01020304; > > > string s(<I dont know how to fill this area>); > > > > > > so that > > > > > > s[0]=0x01; > > > s[1]=0x02; > > > s[2]=0x03; > > > s[3]=0x04; > > > > > > Thanks, > > > Lloyd > > > > > > > > > > > > > > > ______________________________________ > > > Scanned and protected by Email scanner > > > > > > ------------------------------------------------------------------------- > > > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > > > Build the coolest Linux based applications with Moblin SDK & win great prizes > > > Grand prize is a trip for two to an Open Source event anywhere in the world > > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > _______________________________________________ > > > Dev-cpp-users mailing list > > > Dev...@li... > > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > ______________________________________ > Scanned and protected by Email scanner > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Instale a Barra de Ferramentas com Desktop Search e ganhe EMOTICONS para o Messenger! É GRÁTIS! http://www.msn.com.br/emoticonpack |