|
Of those applications that do it, most read from stdin and write to stdout? What exactly is it that you are trying to do?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I want to write numbers to stdin and read them from stdout after console is executed. This code on the link works with pipes, and I've implemented it for running a process and reading its output.
But when to write to stdinput pipe before or after createprocess() function?
9ine
|
|
|
|
|
when you write a very simple program you will need links some lib so that it can run.
so I want to know which lib will need on PC WINDOW platform .
main()
{
int i = 0;
}
the program need what lib to link?
even I create a plain/empty project with vc6(window console), it link many lib for me ,all is a must?
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/testLib.pdb" /debug /machine:I386 /out:"Debug/testLib.exe" /pdbtype:sept
-- modified at 9:00 Tuesday 28th February, 2006
|
|
|
|
|
derek7 wrote: ...all is a must?
No, the only one that will be loaded at runtime is kernel32.dll.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
but I remove all lib it also work.
#include <iostream>
main()
{
int i = 0;
std::cout<<"t\n";
};
the code work without any lib( no kernal.dll )
so I guess the c++ standard lib is linked unapparently
but another question appear :if I DO NOT use cout how to unlink the c++ standard lib ?
BTW: Is c++ standard lib c runtime lib?
-- modified at 9:44 Tuesday 28th February, 2006
|
|
|
|
|
derek7 wrote: the code work without any lib( no kernal.dll )
Even though you removed kernel32.lib from the linker options, kernel32.dll is still "loaded" for your program. Look at the debug window to observe this.
derek7 wrote: BTW: Is c++ standard lib c runtime lib?
Are you referring to msvcrt.dll?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
It's a very unusual question. But i can be wrong. Don't panic to link all the default .lib's. There is no more code as you use (DevStudio does so). But further you can remove all .lib's and bind only libs you want. Sample:
#pragma comment ( lib, "XYZ" ) // thats what i do
M$ itselves has prepared a .csv file to examine what .lib you need. You can find it at:
<xyz>\MSDEV\LIB\WIN32API.CSV
oder <xyz>\Microsoft Visual Studio\VC98\Lib\WIN32API.CSV
and so on.
|
|
|
|
|
//vc6
#include <assert.h>
main()
{
assert(0);
}
when I press F5 a assert window pop and I press retry it should be break at assert(0);but it pop a window again: Find Source , Please enter path for CRT0MSG.C , what is wrong?
|
|
|
|
|
|
I think it is because assert() goes to the finest details.
What you need to do is:
In the Variables tab, change the Context combobox to your function, which should be:
main(int char**)
this is this.
|
|
|
|
|
The debug info of crt*.obj or -.lib is sometimes not included to the debug database or the compiler can't find them. The reason can be a manually installation of DevStudio or installation to another path than the default path. Therefore you have to tell the compiler where the source code file resides.
But you can define your own assert.
#ifdef _DEBUG<br />
#define ASSERT(B) if(!(B)){ __asm{ int 3 } }<br />
#else<br />
#define ASSERT(B)<br />
#endif
|
|
|
|
|
Your program is doing exactly what you have coded it to do (i.e., asserting at line 6). So what's the problem?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi Guys,
Is there any way to change the tab orders for a controls programmatically.
|
|
|
|
|
SetWindowPos
Use wndTop for the first control, and the previous window for the remaining.
"My dog worries about the economy. Alpo is up to 99 cents a can. That's almost seven dollars in dog money" - Wacky humour found in a business magazine
|
|
|
|
|
I think you could try this:
1- Destroy all the controls you want to set the tab-order of.
2- Create them again in the order in which you would like the tab-order.
this is this.
|
|
|
|
|
NO!!!!!!!!!!!!!!!!
Use SetWindowPos to change the Z-Order - TAB order int he dialog merely follows the controls' Z-Order.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
You have probably tested this technique, and I haven't tested my ideas, so I guess you are right.
Thanks for the correction.
this is this.
|
|
|
|
|
Yes, it works well. When you create a control on the fly, you can also use SetWindowPos to 'insert' it into a specific tab order.
You method will work, it is just overkill.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Yes, I also tested my idea yesterday, and it works. But as you said, it is just overkill. SetWindowPos() is much easier and simpler.
this is this.
|
|
|
|
|
Hi,
I want to compare two character arrays containing binary values.
For e.g. if m_Effects array contains 0001, string comparison does not return 0 even if binEffects contains binary equivalent of 1. Even if I do byte by byte comparison same problem occurs.
What does _ltoa exactly perform?
//---------------------------------------------------------------------
for(int i=0; i <16; i++)
{
_ltoa(i, binEffects, 2);
if(strcmp((char *)binEffects, (char *)m_Effects) == 0)
return i;
}
//---------------------------------------------------------------------
Thanks,
Kranti
|
|
|
|
|
u can directly use strcmp/memcmp to comapre two integer array
nave
|
|
|
|
|
when I check the values stored in both of the arrays, something like the following is observed ...
binEffects[3] = '0'
binEffects[2] = '0'
binEffects[1] = ''
binEffects[0] = '1'
and the source array contains ...
m_Effects[0] = '0'
m_Effects[1] = '0'
m_Effects[2] = '0'
m_Effects[3] = '1'
Even if i use memcmp(), it returns -1 if this example is concerned.
Hence, i've a doubt regarding _ltoa function since it sets the values in binEffects.
Kranti
|
|
|
|
|
Did you read my post ?
That is a standard behaviour. If you want to convert an integer (let's say 3) in binary string, you won't have the zeros in front of the number, that sounds logical isn't ?
So, when you convert 3 into a binary string, it's logical that you get '11' and not '0011' (how can the compiler knows that you want 2 zeros at the begining of the string). The same when you convert 1 into a string, you will get '1'.
|
|
|
|
|
I think you want to convert a binary string into its value ? Right ?
Maybe you can write a simple function to do that:
int BoolStringToVal(char* szString)<br />
{<br />
int Value = 0;<br />
for (int Index=strlen(szString)-1; Index>=0; Index--)<br />
{<br />
int BinValue = 1 << (Index - strlen(szString) + 1 );<br />
if (szString[Index])<br />
Value += BinValue ;<br />
}<br />
<br />
return Value;<br />
}
So, what it does is look for each char in the string and if this char is 1 then we add its corresponding value to the total value. The code has not been tested so I'm not sure if this will work, but you got the principle.
|
|
|
|