Click here to Skip to main content
15,902,635 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
General_mkgmtime in msvcrt Pin
Anonymous15-Sep-04 17:04
Anonymous15-Sep-04 17:04 
GeneralTo emmbed Flash (*.swf) into Visual C++ Pin
utnqbao15-Sep-04 16:46
professionalutnqbao15-Sep-04 16:46 
GeneralRe: To emmbed Flash (*.swf) into Visual C++ Pin
rotu16-Sep-04 0:02
rotu16-Sep-04 0:02 
GeneralI can't enumerate my network.Help me, please!!!!!!!! Pin
utnqbao15-Sep-04 16:44
professionalutnqbao15-Sep-04 16:44 
GeneralNew to Visual C++ - Simple Program Help Pin
neoborn15-Sep-04 15:49
neoborn15-Sep-04 15:49 
GeneralRe: New to Visual C++ - Simple Program Help Pin
Christian Graus15-Sep-04 16:24
protectorChristian Graus15-Sep-04 16:24 
GeneralRe: New to Visual C++ - Simple Program Help Pin
neoborn15-Sep-04 18:05
neoborn15-Sep-04 18:05 
GeneralCould really use some suggestions Pin
Tom Wright15-Sep-04 11:49
Tom Wright15-Sep-04 11:49 
I have a Byte buffer that I'm receving data into from an CAsyncSocket call (Receive)

	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 />


In my onParseData function I'm trying to parse out the data. I know that certain parts of the data stream are a fixed length. So I created a structure.

struct ParseData{<br />
    BYTE STAP[4]; <br />
    BYTE BlockLen;<br />
    BYTE HDRLen;<br />
    BYTE FunctionCode;<br />
    BYTE ValField;<br />
    BYTE DataLen;<br />
    BYTE MsgStatus;<br />
    BYTE Dest;<br />
    char* DataPacket;<br />
    BYTE STOP[4];<br />
};<br />
ParseData myStuff;<br />
memcpy(&myStuff, dataBuffer, sizeof(myStuff));<br />


My problem is that I feel that this is not going to work and that I get an exception error because of the char* DataPacket;.

And I'd love to make my sturcture like this:
struct ParseData{<br />
    BYTE STAP[4]; <br />
    int BlockLen;<br />
    int HDRLen;<br />
    int FunctionCode;<br />
    int ValField;<br />
    int DataLen;<br />
    int MsgStatus;<br />
    int Dest;<br />
    char* DataPacket;<br />
    BYTE STOP[4];<br />
};<br />


I just want some direction in to where I need to go to find out:

1. How do I move this BYTE array into this structure?
2. Is there a simple way to just pull out certain parts of the data stream and plop it into the structure? example...move the first 4 bytes to the STAP the second 4 to the BlockLen...etc.


Thanks

Tom Wright
tawright915@yahoo.com
GeneralRe: Could really use some suggestions Pin
Christian Graus15-Sep-04 11:59
protectorChristian Graus15-Sep-04 11:59 
GeneralRe: Could really use some suggestions Pin
Tom Wright15-Sep-04 12:20
Tom Wright15-Sep-04 12:20 
GeneralRe: Could really use some suggestions Pin
Christian Graus15-Sep-04 12:50
protectorChristian Graus15-Sep-04 12:50 
GeneralRe: Could really use some suggestions Pin
Henry miller16-Sep-04 3:34
Henry miller16-Sep-04 3:34 
Generalchange a dialog's font at runtime Pin
BlackDice15-Sep-04 11:47
BlackDice15-Sep-04 11:47 
GeneralRe: change a dialog's font at runtime Pin
Ryan Binns15-Sep-04 18:27
Ryan Binns15-Sep-04 18:27 
GeneralRe: change a dialog's font at runtime Pin
BlackDice16-Sep-04 4:20
BlackDice16-Sep-04 4:20 
GeneralRe: change a dialog's font at runtime Pin
Ryan Binns16-Sep-04 13:59
Ryan Binns16-Sep-04 13:59 
Generaladd help (?) button to title bar of child MDI window Pin
elephantstar15-Sep-04 11:28
elephantstar15-Sep-04 11:28 
GeneralTemplate issue Pin
Bob Stanneveld15-Sep-04 10:32
Bob Stanneveld15-Sep-04 10:32 
GeneralRe: Template issue Pin
Michael Dunn15-Sep-04 10:48
sitebuilderMichael Dunn15-Sep-04 10:48 
GeneralRe: Template issue Pin
Bob Stanneveld15-Sep-04 11:10
Bob Stanneveld15-Sep-04 11:10 
GeneralProtect application from hooking Pin
Fabio Panzavolta15-Sep-04 10:01
Fabio Panzavolta15-Sep-04 10:01 
GeneralRe: Protect application from hooking Pin
User 58385215-Sep-04 15:55
User 58385215-Sep-04 15:55 
GeneralRe: Protect application from hooking Pin
Fabio Panzavolta15-Sep-04 22:47
Fabio Panzavolta15-Sep-04 22:47 
GeneralCost of type Casting Pin
Nacho Chip15-Sep-04 9:59
Nacho Chip15-Sep-04 9:59 
GeneralRe: Cost of type Casting Pin
Andrew Walker15-Sep-04 13:02
Andrew Walker15-Sep-04 13:02 

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.