Strange problem with errno modification while using sprintf call.
-
Hello, I am facing a strange problem in my c Windows application sigle-threaded, using VS2008 compiler. errno is used after system calls to identfiy if any error occured. I have placed checks in my code at various places to know if any exception has occured during a flow. In one of the function, At the beginning of a code block I check for errno occured in previous code block, if errno is zero, the normal flow continues. If errno is non-zero, nothing is done and the function returns with errno. Now, i found out a strange issue, errno that is initialized to 0 at the start of the function, changes its value to 9 after doing a sprintf call. sprintf call is successfull though. Another strange thing about it is that this happens only when the exe is run as service on Windows Vista. If the same exe is run from Visual Studio debugger, this behavior doesn't happen when exe runs from VS directly in either release or debug mode. I can not comprehend the behavior, any help will be appreciated. Thanks. Gajendra
Gajendra
-
Hello, I am facing a strange problem in my c Windows application sigle-threaded, using VS2008 compiler. errno is used after system calls to identfiy if any error occured. I have placed checks in my code at various places to know if any exception has occured during a flow. In one of the function, At the beginning of a code block I check for errno occured in previous code block, if errno is zero, the normal flow continues. If errno is non-zero, nothing is done and the function returns with errno. Now, i found out a strange issue, errno that is initialized to 0 at the start of the function, changes its value to 9 after doing a sprintf call. sprintf call is successfull though. Another strange thing about it is that this happens only when the exe is run as service on Windows Vista. If the same exe is run from Visual Studio debugger, this behavior doesn't happen when exe runs from VS directly in either release or debug mode. I can not comprehend the behavior, any help will be appreciated. Thanks. Gajendra
Gajendra
No answers at all....Surprising.
Gajendra
-
No answers at all....Surprising.
Gajendra
Ok..so nobody knows it....:-)
Gajendra