|
It depends on byte ordering of your packet, i.e
Big Endian:
unsigned int n = (buff[0] << 8) | buff[1];
Little Endian:
unsigned int n = (buff[1] << 8) | buff[0];
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
modified on Thursday, April 17, 2008 8:27 AM
|
|
|
|
|
If I understand correctly, your sequence number you want is in bytes buf[22] and buf[23].
If that's true, you can use a cast to retrieve the value:
unsigned short SeqNo;
SeqNo = *(short*)&buf[22]; Note that if it's only two bytes, it's a short and not an int.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
I'm using custom handler for unhandled exception to generate crash dump file in my application (using XCrashReport). The problem is that it does not handle crash when progeram is freezed and user closes it using task manager. Is there a way how to run my exception handler in this case? It is difficult to explain users when they will find drwatson's crash results (and I think it is different in different windows versions).
Thank you.
rrrado
|
|
|
|
|
I do not think that an application can trap being terminated by Task Manager - too much potential for abuse there, IMHO.
One thing you can try is to create your own watchdog . Create a separate thread whoses sole purpose in life is to send a message (like WM_NULL ) to the main message pump every 10 seconds or so using SendMessageTimeout(...) with an approporiate timeout.
If the timeout expires, intentionally crash the application by doing something like dereferencing a NULL . Maybe that will cause the SEH handler to fire and give you more information about the state of the application?
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
win32 - edges on buttons -
I need to show images on buttons in win32,
but I need that borders of buttons, it's edges will be transparent!!
I don't need them!!
plz, help - I can't find the way to do it
|
|
|
|
|
Is it urgent?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
If it was an urgent query, that would have been posted on the lounge. I am surprised you didn't know this.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Sorry, I first time in this forum...
|
|
|
|
|
You're welcome. Please give yourself a name by editing your profile and then read the guidelines[^] on how to ask a question.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
He used of MemberID for his or her name.
|
|
|
|
|
Actually it is his real name.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CP Automatically assigns the member no. as the members name upon successful registration.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
I can't say it for sure. But I've seen several such new members with their name as their member number while making their first few posts. So, that's my guess.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: I am surprised you didn't know this.
'coz Im new VC++ plz, plz hlp me urgent...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: 'coz Im new VC++ plz, plz hlp me urgent
Well its be late for you can't learn it!
|
|
|
|
|
CPallini wrote: Im new VC++ plz, plz hlp me urgent...
You scumbag! What did you do to CPallini? How did you get his CP password?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Plz sir...CPallini abuz drugz, plz plz help urgent.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: CPallini abuz drugz
Okayyy, now I understand
|
|
|
|
|
Did you search on the codeproject,I think Isaw articles about it.
|
|
|
|
|
Senks for everybody, it was very helpful.
|
|
|
|
|
Hi
I have created a network based video streaming application. Now i want to generate the documentation as well as the flow diagrams and uml diagrams for that project. Can someone suggest me a free nice tool which can do this??
Regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
saqib82 wrote: Now i want to generate the documentation
You can use doxygen[^] for that part. But of course you still have to write the documentation yourself (in the source files). But it generates nice html output files which are really great to document classes and functions.
|
|
|
|
|
I have a list (CList) of pointers. Some of them point to variables in the heap a some others not.
I've defined a destructor that frees the memory space, but the program crashes when I delete a pointer to a variable in the stack.
The question is, is there any way of detecting if a pointer points to a variable in the stack or in the heap??
CMyList::~CMyList()
{
POSITION pos = GetHeadPosition();
while (pos != NULL)
{
if (GetNext(pos) points to the heap)
delete GetAt(pos);
}
RemoveAll();
}
|
|
|
|
|
piul wrote: is there any way of detecting if a pointer points to a variable in the stack or in the heap??
I think its possible to find. Normally the stack size will be 1 MB, so a pointer to an object pointing to stack will have the value between the Stack top - 1MB to Stack top. All other pointer will be pointing to heap. You can get the stack top from the TIB as follows.
DWORD dwStackTop = 0;
__asm
{
mov EAX, FS:[4]
mov dwStackTop, eax
}
modified on Thursday, April 17, 2008 5:21 AM
|
|
|
|