|
My C++ project (embedded real-time stuff) has run nicely for years. Now I split off some of the code to a separate exe. I always test in debug mode, so I didn't worry much about release mode. So when the user starts it in release mode, as soon as the exe is called it comes with "The application has requested runtime to terminate it in an unusual way".
I have seen this before, it was the exe throwing an unhandled exception. But the thing has more exception handlers than code now, and it runs fine in debug. What can be causing this?
I checked the project properties, there is nothing surprising in there. Maybe someone can give me a tip what I should be looking for?
-------------
Bibo ergo sum
|
|
|
|
|
|
|
Make sure to check that any member variable pointers are in the class initialization list and set to NULL. This is usually the number one cause of the behavior you are describing, at least in my shop.
|
|
|
|
|
That was very kind of all of you - I now know that you really can debug in release mode - but the problem was something else entirely.
When I first made my exe it was a dll project, then I decided to make an exe after all, and since I was in a hurry I did this by copying and renaming, then changing the properties to fit.
Anyway, I ended up with both main and InitInstance. Debug runs main, it seems, and release takes InitInstance if it can find one, or maybe main is optimised out. I commented InitInstance out and suddenly all is well.
-------------
Bibo ergo sum
|
|
|
|
|
Hi All,
I need to access the servlet in VC++ and upload the files to servlet.I dont knoe how to do this?I need some ides for this.
Please help me.....
Thanks & Regards,
Anitha
|
|
|
|
|
AnithaSubramani wrote: I need some ides for this.
The idea is, you study and learn the technologies that you need to use, then you program your application using the knowledge you gained. Or perhaps you are not a programmer, I just made that assumption because these forums are intended for programmers.
led mike
|
|
|
|
|
Hi,
I wonder if it´s possible to use the function "select" with serial ports. I think under linux it´s possible but under Windows select returns -1 and WSAGetLastError gives me 10038 (Socket operation on nonsocket. An operation was attempted on something that is not a socket. Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid.)
pseudo code:
HANDLE h = CreateFile( COM1 )
...
FD_SET( (int)h, readfds)
select( 0, readfds, NULL, NULL, timeout )
read the data from serial port
I think the problem is the cast of the HANDLE h to int...
Another possibilty would be the function WaitCommMask but I need a timeout-feature. Has anyone an idea if select can be used with serial ports (under Win)?
Thanks in advance!
Sebastian
|
|
|
|
|
Welcome to code project!
A little advice for posting here in the forums. It might not be a good idea to ask if something is possible and then follow that up with a system error message that clearly states it is not possible. People here deal with some really dense posters most days and you don't really want to make yourself seem like one of those if you really want some help.
sevenH wrote: I need a timeout-feature.
Can you be more specific? Timeout for what?
What is your background dealing with asynchronous operations? There are many different solutions to choose from when working in this area, however none of them should be entered into casually. If you lack experience in these areas you need to take some time to study the subject. There is no magic function to use that makes everything work as intended during asynchronous operations.
led mike
|
|
|
|
|
sevenH wrote: I need a timeout-feature
Does SetCommTimeouts give you what you need?
Judy
Be wary of strong drink. It can make you shoot at tax collectors - and miss.
Lazarus Long, "Time Enough For Love" by Robert A. Heinlein
|
|
|
|
|
Hi All,
i was talking to a guy .. who asked about return 0 or return 1
i told him that it return 0 means code have no run time error and if its return 1 it has some error ...
he asked me from where its coming .. i told its coming from comipler ...
but my answer was not as per his expectation can you please more clerify what should i answer in such cases..
vikas da
|
|
|
|
|
I think the return value always comes from your code.
I think the compiler only compiles the code and gives you the .obj file and does not return any value.
|
|
|
|
|
lets see a simple code
int main ()
{
return 0;
}
in above return 0 is defintly user defined .. is there no relation of this return 0 with compiler ...
i am not very sure ..
vikas da
|
|
|
|
|
Well, in C/C++, 0 means false and non-zero means true. For instance, in platform SDK,
#define FALSE 0
#define TRUE 1
But that is not the same with application exit codes. If the application exit code is 0, then its treated as executed successfully, or else its a warning or error. Check this link[^].
In summery, don't confuse with zero in C/C++ and that of standard DOS exit codes. Both have different meaning.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks Jijo...
so while executing an application or better to say a programm where these DOS Exit codes comes in picture....
1.During comilation..?
2.During run time..?
and how they are handeled..
Thanks again...
vikas da
|
|
|
|
|
Ofcourse during runtime. Dos execute code comes to scene while executing the applications. Seems you need more explanation.
Dos exit code is the return code that every dos application [as well as windows applications] should return. And as per standard, 0 means its executed successfully. The exit code of last executed application is stored in environment variable - ERRORLEVEL . For instance, take the command prompt and type these two commands.
copy blabla balalala
echo %errorlevel%
Since the copy command failed, you can see return code as 1. if you execute a successful command it should return 0.
For C/C++ compiled application, exit code is the integer returned by main() function. If you want to make the exit code of you application as 1 if success, then return 1 from main(). Hope its clear now.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Return value is usually a meaningful info given back to the caller, hence the exact meaning of '0 ' or '1 ' (or whatever) is (usually again) a matter of convention between the caller and the called. For instance the return value of the 'special' C main function is, by convention 0 on success and nonzero on failure.
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]
|
|
|
|
|
tasumisra wrote: i told him that it return 0 means code have no run time error and if its return 1 it has some error ...
There is nothing offical that says it has to be this way. It's all up to the sender and receiver as to what the values mean.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
thanks you all for replies..
i am still not able to understand .. who is this sender reciever...how this communication is happening..
Thank you...
vikas da
|
|
|
|
|
tasumisra wrote: who is this sender reciever...
This is a very basic programming question. In fact, it is communication in its simplest form. When two objects communicate, the "codes" they send back and forth only have meaning to the two objects involved. While some codes are standard, others are not. For example, code 5 from the computer in a Chevrolet may indicate an error in the oxygen sensing unit, while code 5 from the computer in a Dodge may indicate an error in the transmission.
What exactly are you fishing for?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
DavidCrow wrote: For example, code 5 from the computer in a Chevrolet may indicate an error in the oxygen sensing unit, while code 5 from the computer in a Dodge may indicate an error in the transmission.
Oh, US are great!
The 'computer' of my car has just a boolean return value: the fuel warning light...
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]
|
|
|
|
|
thanks alot...i understand now...
vikas da
|
|
|
|
|
Hi,
I was wondering how can i determine if there a registry key is valid or not.
|
|
|
|
|
Well, that largely depends on your definition of "valid".
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thats fair enough.If i want to access the registry key value then it should allow me to access it.
Something which registry cleaner software uses to determine whether to delete the registry key or not.
|
|
|
|