|
Thanks for the info, but the problem turned out to be something else.
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
I suspected it was after reading Richard's post.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Isn't sys/types.h a POSIX include file? Can you use it on Windows (I mean without Cygwin )?
Veni, vidi, vici.
|
|
|
|
|
I just checked - it is in the Windows sys directory.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
If we break this command into its constituent parts we get the following:
cl /nologo
/Ox
/MD
/EHsc
/W3
/D_CRT_SECURE_NO_DEPRECATE
-I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys";
-I.
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys"
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include"
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
-DAVOID_WIN32_FILEIO
-DCHECK_JPEG_YCBCR_SUBSAMPLING
-DDEFAULT_EXTRASAMPLE_AS_ALPHA
-DSTRIPCHOP_DEFAULT=TIFF_STRIPCHOP
-DSTRIP_SIZE_DEFAULT=8192
-DLOGLUV_SUPPORT
-DNEXT_SUPPORT
-DTHUNDER_SUPPORT
-DLZW_SUPPORT
-DPACKBITS_SUPPORT
-DCCITT_SUPPORT
-DTIF_PLATFORM_CONSOLE
-DFILLODER_LSB2MSB
/c
tif_unix.c
tif_unix.c
tif_unix.c
(35) : fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
The only directories included by the -I option are "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys" and . (dot). All the other directory names seem to be orphaned in the command line. I'm also not sure why "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys" has that semi-colon character after it. I think you need to check your NMAKE source file.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
You nailed it Richard! That was the problem! Many thanks (and 5 points)!
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Maybe it's a copy/paste bug but that command line doesn't look right to me.
1. The second include is given with option "-I.", that dot doesn't belong there.
2. The rest of the include paths are given without -I arg so the compiler probably won't know what to do with those.
|
|
|
|
|
1. That just means add the current directory to the include path(s).
2. I already noted this in my comment above.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
1. Yes that could be the intention, but the compiler would look there in any case, wouldn't it?
2. So then we know it took me more than 36 minutes to type in that comment. No wonder I'm not a regular...
|
|
|
|
|
1. Not all compilers do that automatically. As far as I recall some flavours of UNIX require this.
2. Apologies, I did not check the time differences.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
1. Oh absolutely,
2. you were right, though.
|
|
|
|
|
That was the problem (as Richard also pointed out). Thanks and 5 points!
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
Is it safe to pass CComVariant declared locally to other function
1. Can I pass the CommVariant to other function, when not created using new ?
2. Should I free it/delete expecitly some where ?
3. Is it safe ? any precauions ?
CComVariant comVart;
comVariant.vt = VT_I4;
comVariant.intVal = 10;
SendComVariantToOtherFunction(comVart);
Thanks in advance!!
|
|
|
|
|
ptr_Electron wrote: 1. Can I pass the CommVariant to other function, when not created using new ?
Yes.
ptr_Electron wrote: 2. Should I free it/delete expecitly some where ?
No, when not allocated on the heap. When using new , it must be of course freed using delete . Everything else is done by the destructor.
ptr_Electron wrote: 3. Is it safe ? any precauions ?
It is safe. But you must take care when assigning data (type and data must match).
|
|
|
|
|
I want ot check CComVariant.boolval is valid and extract bool value from it
if(SUCCEEDED(m_abc->GetProperty("test", comVar)))
{
if (comVar.boolVal == VARIANT_TRUE)
{
}
}
please help!
|
|
|
|
|
It could be that m_abc->GetProperty returns something other than a bool, so you should also check comVar.vt to see that you really have a boolean.
|
|
|
|
|
You must also check the vt member. When expecting a boolean value, it must be VT_BOOL . When the requested property exists but did not contain a value, VT_EMPTY or VT_NULL are returned (the return type depends on the property value type).
|
|
|
|
|
I have craeted following kind of function in a class:
void SetStr(string& s1, string& s2)
{
const char* s =(s1+s2).c_str();
cout<
|
|
|
|
|
The result of an expression is temporary, and it is destroyed an the and of the expression evaluation.
In your first case, you are getting a temporary string as a result of s1+s2 , whose buffer pointer is saved in s. After that, the expression finish, the temporary is destroyed, and so it is its buffer and s is left dangling. You had been lucky in having printed nothing. accessing a deleted buffer can even result in a crash.
In your second example, the temporary string resulting from s1+s2 is kept alive until the expression it belongs ( cout<<(s1+s2).c_str()<<endl; ) is evaluated. Hence its buffer (renturned from c_str() ) is still there at the time its pointer is given to cout .
Your first sample works correctly if you retain the string:
void SetStr(string& s1, string& s2)
{
string ss;
ss = s1+s2;
const char* s = ss.c_str();
cout << s << endl;
}
2 bugs found.
> recompile ...
65534 bugs found.
modified 22-Feb-12 14:48pm.
|
|
|
|
|
Great answer.
You miss an underscore in your sample code.
--Carlo The Nitpick
Veni, vidi, vici.
|
|
|
|
|
But no applause for this guy standard c_str() problem in C++[^]
but why do we have two forums on the same subject. Sorry I'm just outta the rock.
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
I'm running a cosmetic loop, and I think I should check to see if the CreateProcess is still running. I've seen other post for the same thing, but could not remember the nomenclature for it.
Just looking for recommendations
I played around with checking the exit code, but I know it's not the proper way to do it
GetExitCodeProcess(pi.hProcess, (unsigned long *)&exit_status);
if (exit_status != 259)
break;
My CreateProcess
if (CreateProcess(sz_SQLServer_Install_FileName, szParameters, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | NORMAL_PRIORITY_CLASS, 0, sz_SQLServer_Install_FolderPath, &si, &pi) ) {
while(WAIT_TIMEOUT == WaitForSingleObject(pi.hProcess, 10)) {
MSG oMSG;
while(::PeekMessage(&oMSG, NULL, 0,0, PM_NOREMOVE)) {
if(::GetMessage(&oMSG, NULL, 0,0) ) {
::TranslateMessage(&oMSG);
::DispatchMessage(&oMSG);
}
else {
break;
}
|
|
|
|
|
Hi Jim,
What problems are you having? The call to GetExitCodeProcess looks good to me although not sure why you needed the cast on exit_status.
Also... WaitForSingleObject will return WAIT_OBJECT_0 when the process has exited.
|
|
|
|
|
The original problem that lead to the question was that when the program running in the process was canceled, or halted due to a requirement missing, the cosmetic loop would still be running, instead of exiting and sending the appropriate message to the message pump to go to the next stage. So I added the GetExitCode to double check that the process was still running, or if the process had been halted.
Just didn't think my quick fix was the correct way to check, and just wanted to do it right.
|
|
|
|