Re: [Dev-C++] initializing string with memory buffer
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Per W. <pw...@ia...> - 2008-09-15 13:20:42
|
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 > |