|
Me too, expecially with Carlo.
BTW thank you...
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
[My articles]
|
|
|
|
|
holy crap!!!
other than :
<br />
int main()<br />
{<br />
return 1;<br />
}
I can't think of anything else.
Watched code never compiles.
|
|
|
|
|
slamdunk1234567 wrote: can i pls get d code
Look, please make up your mind, do you want C code or d code?
It's time for a new signature.
|
|
|
|
|
|
Excellent!
Ali
|
|
|
|
|
slamdunk1234567 wrote: pls
slamdunk1234567 wrote: plz
You kids nowadays can't even be consistent with your numb-skull-txt-speak lingo.
|
|
|
|
|
Hi,
I have a multi-thread app which can sometimes run for weeks but on occasions it hangs with the egg timer and needs to be killed with task manager. I suspect that it might be a thread deadlock but I do not know for sure. I have checked for potential deadlocks as best I can but I cant see any.
Does anyone have any suggestions how I might get more information as to where the hang occurs? Is there something I could do (in the release version) to prove it is a thread dedlock (or something else)? I have found a couple of places where I am accessing GUI objects from another thread but in my experience this usually causes a crash rather than a hang. I have corrected these now by the way but havent tried it on the target system.
Are there any tools that might help?
Any advice woud be appreciated as its driving me mad.
Thanks Tony
|
|
|
|
|
softwaremonkey wrote: I have found a couple of places where I am accessing GUI objects from another thread but in my experience this usually causes a crash rather than a hang.
Actually, deadlock (i.e., hang) is a very common symptom when one thread attempts to access another thread's UI components. The primary thread, which owns the UI, may be in a blocked state, and if the secondary thread is interacting with its UI components (e.g., sending them a message), deadlock will occur.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Thanks David, I will try to find all instances of this error but its very hard to track these and you never REALLY know that the problem has been fixed. It would be great to be able to replicate the problem then find out what's causing it.
Tony
|
|
|
|
|
You could use a debugger like Windbg to connect to the process.
Windbg has a command ~ which lists the status of all threads in the process.
|
|
|
|
|
Thanks for the reply.
I have WinDbg but I don't really understand how to use it to debug hangs. If I kill the process with Windows Task Manager I dont get a minidump yet I dont seem to be able to see any hangs if I run the app from within WinDbg (I created a test app which deliberately locks up)
Any hints and tips
Tony
|
|
|
|
|
You don't have to kill the process.
Select File -> Attach to process from the menu and attach to the already running/hung process.
|
|
|
|
|
I'm not that experienced with WinSock2 so forgive me for my bad ERROR_HANDLING.
Currently I have this line of code, breaking my application!
BytesReceived = recv(IPv4, Data, sizeof(Data), 0);
Yet I believe the worst case scenario the receive buffer would be empty and BytesReceived will be -1.
Unless their is a bigger picture missing, could you give me a heads up!
I'm currently using the HTTP protocol with blocking sockets! If you think it's a bad design strategy, please inform me!
1) send HTTP request
2) receive HTTP response
3) buffer[512] bytes, so HTTP response + data, separate them
|
|
|
|
|
What do you mean by break?
|
|
|
|
|
«_Superman_» wrote: What do you mean by break?
Die?
|
|
|
|
|
«_Superman_» wrote: What do you mean by break?
Someone said coffee break?
|
|
|
|
|
Unhandled exception at 0x761ed252 in Win32.exe: 0xC0000005: Access violation writing location 0x00000000.
Keeps pointing at the recv function line!
Update:
WriteFile(File, Data, BytesReceived, NULL, NULL);
This line is causing the trouble, but can't identify the problem!
File is the CreateFile handle.
Data is the recv buffer from WinSock2.
BytesReceived is in the int returned by recv.
modified on Tuesday, May 4, 2010 9:25 PM
|
|
|
|
|
Validate the "BytesReceived" variable(0 to 65535) and send it to the WriteFile fn. If u r passing the BytesToWrite as -1, than this will cause the overflow of DWORD variable which will exceeds the max value.
----Parthiban
|
|
|
|
|
hi friends,
unsigned char Cstr[100] = "this is a program";
i want remove spaces from Cstr;
please help any body
|
|
|
|
|
copy the string char by char and skip the spaces.
Watched code never compiles.
|
|
|
|
|
unsigned char pChar[100] = "i like vc++! ";
printf("%s\n%s",pChar);
it will compile and run..but it displaying 100 characters...
100 character means i like vc++ after null
please help me any body
|
|
|
|
|
Member 3653751 wrote: printf("%s\n%s",pChar);
When your format string has two %s specifiers, you must have two parameters after the format string.
So add one parameter to printf() or remove one %s from format string.
modified on Tuesday, May 4, 2010 11:35 AM
|
|
|
|
|
nothing here shows you are "trimming" the string; and there's an extra "%s" in the format part of printf.
Watched code never compiles.
|
|
|
|
|
Member 3653751 wrote: unsigned char pChar[100] = "i like vc++! ";
printf("%s\n%s",pChar);
Member 3653751 wrote: it will compile and run..but it displaying 100 characters...
Because Visual C++ doesn't like you.
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
[My articles]
|
|
|
|
|
Hi.
This litte program copys the string char by char and skips the spaces.
#include <iostream.h>
int count=0,count2=0;
int strLength=0;
int main()
{
unsigned char Cstr[100] = "this is a program";
unsigned char Cstr2[100] = "";
while(Cstr[count] != '\0')
{
if((int)Cstr[count] !=32)
{
Cstr2[count2 ] = Cstr[count];
count2++;
}
count++;
strLength++;
}
for(count=0;count<strLength;count++) cout<<Cstr2[count]<<"";
cout<<"\n\n\n";
return 0;
}
|
|
|
|