Click here to Skip to main content
15,891,372 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Change Icon of exe Pin
Arsalan Malik13-Sep-04 18:49
Arsalan Malik13-Sep-04 18:49 
GeneralRe: Change Icon of exe Pin
Ryan Binns13-Sep-04 20:50
Ryan Binns13-Sep-04 20:50 
GeneralLocalization of negative numbers Pin
PJ Arends13-Sep-04 13:15
professionalPJ Arends13-Sep-04 13:15 
GeneralRe: Localization of negative numbers Pin
cmk13-Sep-04 23:42
cmk13-Sep-04 23:42 
GeneralRe: Localization of negative numbers Pin
PJ Arends14-Sep-04 6:53
professionalPJ Arends14-Sep-04 6:53 
GeneralMFC threading issue... Pin
the_augy13-Sep-04 12:59
the_augy13-Sep-04 12:59 
GeneralUpdate to my question (a doozy!) Pin
the_augy13-Sep-04 14:31
the_augy13-Sep-04 14:31 
GeneralAnother string question....I think Pin
Tom Wright13-Sep-04 12:29
Tom Wright13-Sep-04 12:29 
I'm using the CAsyncsocket Receive to receive a string into a BYTE buffer. Now I want to parse out the data into a structure. One of the stucture items is an int.

So my structure is like this (this is an example)
<br />
struct myMsg {<br />
       BYTE START[4];<br />
       int bLen;<br />
       int hLen;<br />
}<br />


My receive function is setup like this:
	BOOL bRetCode;<br />
	DWORD dwBytesToRead;<br />
<br />
	bRetCode = m_sConnectSocket.IOCtl(FIONREAD, &dwBytesToRead);<br />
<br />
	BYTE* RecvBuffer = new BYTE[(int)dwBytesToRead];<br />
<br />
	m_sConnectSocket.Receive(RecvBuffer, sizeof(RecvBuffer));<br />
	<br />
	onParseData(RecvBuffer, sizeof(RecvBuffer));<br />



I'm having problems moving bLen into the structure from the BYTE array.

I'm trying to do it like this:

	int CLAGCICDlg::onParseData(BYTE* dataBuffer, int bufferSize)<br />
<br />
        BYTE* mybuffer = dataBuffer;<br />
	myMsg myStuff;<br />
<br />
	memcpy(myStuff.START, dataBuffer, 4);<br />
	myStuff.BlockLen = reinterpret_cast<int>(dataBuffer[5]);<br />
}<br />

Am I one the right track? I get an error on the reinterpret_cast. Suggestion?

Thanks

Tom Wright
tawright915@yahoo.com
GeneralRe: Another string question....I think Pin
Arsalan Malik13-Sep-04 18:36
Arsalan Malik13-Sep-04 18:36 
Generaldelegating events from child to parent Pin
prateekkathuria13-Sep-04 11:10
prateekkathuria13-Sep-04 11:10 
GeneralHeight of Text Pin
Joel Holdsworth13-Sep-04 10:40
Joel Holdsworth13-Sep-04 10:40 
GeneralRe: Height of Text Pin
Joel Holdsworth13-Sep-04 11:14
Joel Holdsworth13-Sep-04 11:14 
GeneralRe: Height of Text Pin
cmk13-Sep-04 13:00
cmk13-Sep-04 13:00 
GeneralCopy Constructor Pin
Prudhvi Raju13-Sep-04 10:10
Prudhvi Raju13-Sep-04 10:10 
GeneralRe: Copy Constructor Pin
act_x13-Sep-04 10:25
act_x13-Sep-04 10:25 
GeneralRe: Copy Constructor Pin
BlackDice13-Sep-04 11:58
BlackDice13-Sep-04 11:58 
GeneralRe: Copy Constructor Pin
Anonymous13-Sep-04 12:14
Anonymous13-Sep-04 12:14 
QuestionHow to idintify a DLL whether it is a normal dll or it is a COM DLL Pin
Prudhvi Raju13-Sep-04 9:57
Prudhvi Raju13-Sep-04 9:57 
AnswerRe: How to idintify a DLL whether it is a normal dll or it is a COM DLL Pin
Anonymous13-Sep-04 15:14
Anonymous13-Sep-04 15:14 
GeneralDoc View architecture Pin
act_x13-Sep-04 9:41
act_x13-Sep-04 9:41 
GeneralRe: Doc View architecture Pin
Joel Holdsworth13-Sep-04 10:48
Joel Holdsworth13-Sep-04 10:48 
GeneralRe: Doc View architecture Pin
BlackDice13-Sep-04 12:02
BlackDice13-Sep-04 12:02 
GeneralC/C++ Scripters Wanted For New Games Company Pin
KingsZone13-Sep-04 8:32
sussKingsZone13-Sep-04 8:32 
GeneralRe: C/C++ Scripters Wanted For New Games Company Pin
Michael Dunn13-Sep-04 8:54
sitebuilderMichael Dunn13-Sep-04 8:54 
GeneralVC IDE Pin
Scott L. Robik13-Sep-04 8:10
Scott L. Robik13-Sep-04 8:10 

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.