Click here to Skip to main content
15,909,742 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Solution: use CSplitterWnd::SetRowInfo Pin
Dialecticus24-Oct-11 22:48
Dialecticus24-Oct-11 22:48 
AnswerRe: Splitter with fixed size Pin
TheGreatAndPowerfulOz25-Oct-11 5:06
TheGreatAndPowerfulOz25-Oct-11 5:06 
GeneralRe: Splitter with fixed size Pin
Dialecticus25-Oct-11 6:14
Dialecticus25-Oct-11 6:14 
Questionhow to Add the help file in SDI Application Pin
sarfaraznawaz23-Oct-11 21:01
sarfaraznawaz23-Oct-11 21:01 
AnswerRe: how to Add the help file in SDI Application Pin
Richard MacCutchan23-Oct-11 22:38
mveRichard MacCutchan23-Oct-11 22:38 
AnswerRe: How to call the html help api Pin
App_24-Oct-11 6:25
App_24-Oct-11 6:25 
QuestionSetCurrentDirectory Pin
sarfaraznawaz23-Oct-11 19:42
sarfaraznawaz23-Oct-11 19:42 
AnswerRe: SetCurrentDirectory Pin
tolw23-Oct-11 21:58
tolw23-Oct-11 21:58 
AnswerRe: SetCurrentDirectory Pin
App_24-Oct-11 2:58
App_24-Oct-11 2:58 
Questionworking with byte arrays Pin
jkirkerx22-Oct-11 8:58
professionaljkirkerx22-Oct-11 8:58 
AnswerRe: working with byte arrays Pin
Chuck O'Toole22-Oct-11 9:35
Chuck O'Toole22-Oct-11 9:35 
GeneralRe: working with byte arrays Pin
jkirkerx22-Oct-11 15:46
professionaljkirkerx22-Oct-11 15:46 
AnswerRe: working with byte arrays Pin
Albert Holguin22-Oct-11 12:02
professionalAlbert Holguin22-Oct-11 12:02 
GeneralRe: working with byte arrays Pin
jkirkerx22-Oct-11 15:51
professionaljkirkerx22-Oct-11 15:51 
AnswerRe: working with byte arrays Pin
Richard MacCutchan22-Oct-11 21:46
mveRichard MacCutchan22-Oct-11 21:46 
GeneralRe: working with byte arrays Pin
jkirkerx23-Oct-11 8:07
professionaljkirkerx23-Oct-11 8:07 
GeneralRe: working with byte arrays Pin
Richard MacCutchan23-Oct-11 8:26
mveRichard MacCutchan23-Oct-11 8:26 
AnswerRe: working with byte arrays Pin
Erudite_Eric23-Oct-11 1:58
Erudite_Eric23-Oct-11 1:58 
GeneralRe: working with byte arrays Pin
jkirkerx23-Oct-11 8:22
professionaljkirkerx23-Oct-11 8:22 
GeneralRe: working with byte arrays Pin
Goto_Label_23-Oct-11 8:44
Goto_Label_23-Oct-11 8:44 
GeneralRe: working with byte arrays Pin
Richard MacCutchan23-Oct-11 9:02
mveRichard MacCutchan23-Oct-11 9:02 
assuming this is the format of all messages that you need to process, it looks like the message format is :
Addr Content
0    05
1    0084  (as bytes 8400)
3    "ServerName;DELLC521-01;InstanceName;SQLEXPRESS;IsClustered;No;Version;10.50.1600.1;;"

Byte zero contains some flag or identifier (no idea what)
Bytes 1 & 2 contain a 16-bit integer giving the length of the following data
Bytes 3 - n contain the message data, which in this case is a semi-colon delimited string.

So given the above information your message processor can copy the characters (using the length information) into a proper null-terminated string buffer. That string may then be split into tokens and each required value can be found by comparing the keywords with known tokens. Something like:
C++
int msgLength = buffer[2] << 8 + buffer[1];
char* szWords = new char[msgLength + 1];
strncpy(szWords, buffer + 3, msgLength);
// remainder of code left as an exercise for the reader
// use strtok() to extract each token
//     strcmp() to look for keywords
//
// alternatively use std::string to parse and extract

Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman



GeneralRe: well done, you cracked the code Pin
App_23-Oct-11 9:06
App_23-Oct-11 9:06 
GeneralRe: working with byte arrays Pin
jkirkerx23-Oct-11 9:18
professionaljkirkerx23-Oct-11 9:18 
GeneralRe: working with byte arrays Pin
jkirkerx23-Oct-11 9:30
professionaljkirkerx23-Oct-11 9:30 
GeneralRe: working with byte arrays Pin
Richard MacCutchan23-Oct-11 9:38
mveRichard MacCutchan23-Oct-11 9:38 

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.