|
Yes. The system will correctly handle multiple threads reading from any input (socket, file, or stdin), and will handle multiple threads writing to an output, within a fixed size
|
|
|
|
|
Thanks, Johnny buddy!
What do you mean by saying "... correctly handle ...", I think we need mutex
or some other synchronization methods.
What do you mean?
regards,
George
|
|
|
|
|
Hello,
stdin is just a buffer. When you type characters in you console app, they are all put in the buffer.
I recommand that you don't use close(stdin) in a child process that shares the stdin with the parent process! That way, your parent process can't read from stdin and you'll get runtime errors. (if you are able to close stdin in the first place )
hope this helps a bit...
|
|
|
|
|
Thanks, Bob buddy!
But I am but agree with you. Under Linux environment, even if a parent process close stdin and the child process can still read from stdin.
I can give you an example, the codes are taken from open source project,
miniterm,
--------
switch (fork())
{
case 0: /* child */
/* user input */
close(1); /* stdout not needed */
for (c=getchar(); c!= ENDMINITERM ; c=getchar()) write(fd,&c,1);
tcsetattr(fd,TCSANOW,&oldtio); /* restore old modem setings */
tcsetattr(0,TCSANOW,&oldstdtio); /* restore old tty setings */
close(fd);
exit(0); /* will send a SIGCHLD to the parent */
break;
case -1:
perror("fork");
tcsetattr(fd,TCSANOW,&oldtio);
close(fd);
exit(-1);
default: /* parent */
close(0); /* stdin not needed */
sa.sa_handler = child_handler;
sa.sa_flags = 0;
sigaction(SIGCHLD,&sa,NULL); /* handle dying child */
while (STOP==FALSE) /* modem input handler */
{
read(fd,&c,1); /* modem */
write(1,&c,1); /* stdout */
}
wait(NULL); /* wait for child to die or it will become a zombie */
break;
}
--------
So, what do you think about it?
regards,
George
|
|
|
|
|
Hmmm, sorry, can't help you there, I don't have any knowledge about linux/unix/... OS's
|
|
|
|
|
Thanks all the same, Bob buddy!
George
|
|
|
|
|
Why do i get this linking error.. what it realy means.. i read in the MSDN but does not realy understand it..
Linking...
Creating library ../../bin/MyDLL.lib and object ../../bin/MyDLL.exp
LINK : warning LNK4089: all references to "MyDLL1.dll" discarded by /OPT:REF
LINK : warning LNK4089: all references to "MyDLL2.dll" discarded by /OPT:REF
|
|
|
|
|
It's a warning, not an error. You are linking with the import LIBs for MyDLL1 and MyDLL2, but you are not calling any functions in either of those DLLs. From the /OPT:REF help:Use /OPT:REF to eliminate functions and/or data that is never referenced. Since you never use anything in those DLLs, the linker removes the import LIBs so MyDLL.dll doesn't (needlessly) implicitly link with those other two DLLs.
--Mike--
"Big handwavy generalizations made from a position of deep ignorance is one of the biggest wastes of time on the net today.
-- Joel Spolsky
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
thanks mike.. realy appreciate it..
|
|
|
|
|
Hello,
Is there also a #pragma command availeble for that? thanks
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
For disabling the warning? Probably, but that's the total wrong way to go. When you get a warning, the compiler is flagging something it thinks is wrong. In 99% of the cases, the compiler is right. Fix the warning, don't shut the compiler up.
(The 1% would be for example C4786 in VC 6 which is harmless but unavoidable when using STL.)
--Mike--
"Big handwavy generalizations made from a position of deep ignorance is one of the biggest wastes of time on the net today.
-- Joel Spolsky
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Thanks for the advice
... I've got some warnings to fix;)...
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Michael Dunn wrote:
The 1% would be for example C4786 in VC 6 which is harmless but unavoidable when using STL
:shudder: C4786 is such an ugly message.
I prefer to wear gloves when using it, but that's merely a matter of personal hygiene
[Roger Wright on VB]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
[Rich Cook]
|
|
|
|
|
I would like to get at the selection in a CHTMLEditView so I can modify it and reinsert it back in to the view. Specifically I am looking to add the option to format the selection as a superscript or subscript. If I can get what is selected on screen into a CString I will be 90% there. Any suggestions? TIA
Matt (Padawan Learner)
|
|
|
|
|
The easiest way would be to copy the selected text to the clipboard and then retrieve the text from the clipboard
ExecHelperNN(IDM_COPY)
I have an article on CP that illustrates how to retrieve text from the clipboard.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
Thanks, that should get me going in the right direction. I don't suppose you have a link to that article?
Matt (Padawan Learner)
|
|
|
|
|
|
Pasting text basically amounts to the following
if (OpenClipboard())
{
HANDLE hClipboardData = GetClipboardData(CF_TEXT);
char *pchData = (char*)GlobalLock(hClipboardData);
CString strFromClipboard = pchData;
GlobalUnlock(hClipboardData);
CloseClipboard();
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
Thanks a lot, that article did the trick.
Matt (Padawan Learner)
|
|
|
|
|
This seems to work...
CString CHTMLEditView::GetSelection(void)
{
IDispatch * pDocDisp = NULL;
IHTMLDocument2* pDoc;
IHTMLSelectionObject* pSelObj;
IHTMLTxtRange* pTxtRange;
CString cstext;
pDocDisp = GetHtmlDocument();
HRESULT hr = pDocDisp->QueryInterface( IID_IHTMLDocument2, (void**)&pDoc );
if (SUCCEEDED(hr)) {
hr = pDoc->get_selection(&pSelObj);
CComBSTR p;
pSelObj->get_type(&p);
if ((SUCCEEDED(hr))&&((p==L"Text")||(p==L"None"))) {
hr = pSelObj->createRange((IDispatch**)&pTxtRange);
if (SUCCEEDED(hr)) {
BSTR text;
pTxtRange->get_htmlText(&text);
cstext = text;
SysFreeString(text);
pTxtRange->Release();
}
pSelObj->Release();
}
pDocDisp->Release();
pDoc->Release();
}
return cstext;
}
To put a string back into the selection use pTxtRange->pasteHTML(text) instead of pTxtRange->get_htmlText(&text)
Niall.
|
|
|
|
|
i want to make a groupbox's title transparent,can I
|
|
|
|
|
Maybe I'm misunderstanding you. Why don't you just set it's text to a blank value if you simply don't want to see a text value?
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
I have gotten a path to a file as being '\Device\HarddiskVolume2\Program Files\Visual Assist.NET\vc7\VaCPPP.tmp'. I need to be able to convert it to 'c:\Program Files\Visual Assist.NET\vc7\VaCPPP.tmp', Is the original path that i have been given classed as a symbolic link, and if so how can i resolve this to a Drive Letter and Path. If it is not a symbolic link that what is it called or reffered to as.
Regards
Amleth
|
|
|
|
|
Amleth,
From the Windows XP Help Glossary:
An area of storage on a hard disk. A volume is formatted by using a file system, such as FAT or NTFS, and has a drive letter assigned to it. You can view the contents of a volume by clicking its icon in Windows Explorer or in My Computer. A single hard disk can have multiple volumes, and volumes can also span multiple disks.
The first name you have is not a symbolic link but the location of the file given the device name (\Device\HarddiskVolume2). The mapping of is recorded in the registry somewhere (under HKEY_LOCAL_MACHINE I think). The value is only registered if you have volumes enabled. If your right-click on a drive and go into properties. Select the hardware tab and then select the device and then properties again, you will see the volumes on the drive there recorded in the Volumes tab.
To get to this from C++ you will need to use one of the registry classes (I don't use them as I concentrate on Standard C++ so I can't advise further).
Hope this helps,
Jim Bannon
(When in doubt, try honesty!)
|
|
|
|
|
Hello all,
I know I've done this before, but my code notes don't reflect it, and I can't for the life of me remember how to do it. It's probably easy, but the easy solutions always illude me.
My app needs to either process data, or not process data at startup depending on a registry setting. The user is also able to stop or start the process via a menu item. If the process is started at startup, then the stop menu item needs to be enabled and the start menu item needs to be disabled. If the process is stopped at startup, then the opposite must occur in the menu's. The registry setting is read at startup.
Here's my questions:
1. Where does the registry read function go? OnCreateClient, or PreCreateWindow?
2. In the Update functions for each menu ie start process and stop process, how do I enable one and disable the other, and vice versa.
Thanks!
Frank
"Keyboard Error - Press F1 to Continue"
|
|
|
|