Click here to Skip to main content
15,884,629 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Thanks Pin
ThatsAlok6-Dec-07 20:17
ThatsAlok6-Dec-07 20:17 
GeneralRe: Thanks Pin
Nelek6-Dec-07 21:23
protectorNelek6-Dec-07 21:23 
GeneralRead a byte stream into separate buffers. Pin
CodingLover5-Dec-07 22:22
CodingLover5-Dec-07 22:22 
GeneralRe: Read a byte stream into separate buffers. [modified] Pin
toxcct5-Dec-07 22:31
toxcct5-Dec-07 22:31 
GeneralRe: Read a byte stream into separate buffers. Pin
CodingLover5-Dec-07 22:51
CodingLover5-Dec-07 22:51 
GeneralRe: Read a byte stream into separate buffers. Pin
toxcct5-Dec-07 22:55
toxcct5-Dec-07 22:55 
GeneralRe: Read a byte stream into separate buffers. Pin
CodingLover5-Dec-07 23:04
CodingLover5-Dec-07 23:04 
GeneralRe: Read a byte stream into separate buffers. [modified] Pin
toxcct5-Dec-07 23:05
toxcct5-Dec-07 23:05 
what about using strncpy() and pass it the integer formerly extracted ?
<font color="green">//The 4 bytes buffer</font>
 nSize = 0;
 
<font color="green">//The 4 bytes extract</font>
::memcpy(&nSize, InMsg.GetDataBuffer(), <font color="blue">sizeof</font>(nSize));
 
char* pszBuffer = new char[nSize + 1];  <font color="green">//+1 is for the trailing \0 character</font>
::strncpy(pszBuffer, <font color="green">/* your source data */</font>, nSize);
pszBuffer[nSize] = <font color="gray">'\0'</font>;
std::string strData = pszBuffer;
delete[] pszBuffer;



modified on Thursday, December 06, 2007 5:15:54 AM

GeneralRe: Read a byte stream into separate buffers. Pin
CodingLover5-Dec-07 23:15
CodingLover5-Dec-07 23:15 
GeneralRe: Read a byte stream into separate buffers. Pin
toxcct5-Dec-07 23:19
toxcct5-Dec-07 23:19 
GeneralRe: Read a byte stream into separate buffers. Pin
CodingLover5-Dec-07 23:48
CodingLover5-Dec-07 23:48 
GeneralRe: Read a byte stream into separate buffers. Pin
toxcct5-Dec-07 23:54
toxcct5-Dec-07 23:54 
GeneralRe: Read a byte stream into separate buffers. Pin
CodingLover6-Dec-07 0:00
CodingLover6-Dec-07 0:00 
GeneralRe: Read a byte stream into separate buffers. Pin
toxcct6-Dec-07 0:07
toxcct6-Dec-07 0:07 
GeneralRe: Read a byte stream into separate buffers. Pin
CodingLover6-Dec-07 0:28
CodingLover6-Dec-07 0:28 
GeneralRe: Read a byte stream into separate buffers. [modified] Pin
toxcct6-Dec-07 1:55
toxcct6-Dec-07 1:55 
GeneralRe: Read a byte stream into separate buffers. Pin
CodingLover6-Dec-07 17:28
CodingLover6-Dec-07 17:28 
GeneralRe: Read a byte stream into separate buffers. Pin
jhwurmbach6-Dec-07 4:11
jhwurmbach6-Dec-07 4:11 
GeneralRe: Read a byte stream into separate buffers. Pin
CodingLover6-Dec-07 17:31
CodingLover6-Dec-07 17:31 
GeneralRe: Read a byte stream into separate buffers. Pin
CodingLover5-Dec-07 23:39
CodingLover5-Dec-07 23:39 
GeneralRe: Read a byte stream into separate buffers. Pin
CPallini5-Dec-07 23:44
mveCPallini5-Dec-07 23:44 
GeneralRe: Read a byte stream into separate buffers. Pin
CodingLover5-Dec-07 23:51
CodingLover5-Dec-07 23:51 
GeneralRe: Read a byte stream into separate buffers. Pin
David Crow6-Dec-07 2:56
David Crow6-Dec-07 2:56 
JokeOf course, on such systems you need a CRC... Pin
CPallini5-Dec-07 23:20
mveCPallini5-Dec-07 23:20 
GeneralRe: Of course, on such systems you need a CRC... Pin
toxcct5-Dec-07 23:24
toxcct5-Dec-07 23:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.