|
In process migration, there should be a way of restarting a suspended process(check pointed process) in the other machine on the network. Ifact i want to used the saved process information like baseaddress, context e.t.c after it was suspended. So there should be a possible way. But the big question how????
oam
|
|
|
|
|
I wrote some MSDOS programs in C++ many years ago (Borland's C++) and so I'm not very knowledgeable about the current Visual C++, but here is what I want to do and it doesn't seem like it should be too difficult.
I have a web site that displays a table of records and each line has a microphone icon on it. When the user clicks on that mic icon another web page is opened and it tells the user they may create a dictation. (We have special dictation mics running from a vb.net app that runs from the user's local machine.) We also have an image display program running at the same time and it also runs from the user's machine.
The web app knows what the StudyID is but the vb.net apps don't and I need to be able to pass that StudyID to the local machine so it can be used by the image display program to find the correct images to display while the user is dictating.
I wrote a "faux" activeX (dll) in vb.net that could be placed on the web site and run when the 2nd page is displayed and the studyID could be passed to it and then it would use the study ID and the Process class to cause the image display program to display the correct images, but that would require each user's machine to have the correct security manually setup in .Net Configuration and we don't want to have to do that. So I thought maybe an ActiveX written in C++ could basically do the same thing.
Does this make sense? Could this be done and if so, would it be as easily done as I think it might be.
|
|
|
|
|
I'm having trouble figuring out what to do with this program...any help would be greatly appreciated
Cheers!
Write a program that prompts for a file name and then reads the file to
check for balanced curly braces, {}; parentheses, (); and square brackets,
[]. Use a stack to store the most recent unmatched left symbol. The program
should ignore character that is not a parenthesis, curly brace, or square
bracket. Note that proper nesting is required. For instance, [a(b]c) is
invalid.
Sample runs:
Output
1. {{a+5}-7*[1-{4/2}]}/{2*(3-6)} Valid
2. {(a+5)-7*[1-{4/2}])/{2*(3-6)} Invalid
|
|
|
|
|
It sounds like the purpose is for you to write a stack class then use it. Your C++ book should describe the operations.
First you need to write a stack class.
Then while scanning the file, when ever you see a left { or [, you should push that character on the stack, and when you see a } or a ], you should check the top of the stack to see if the item that would be popped off is the same as the value you are comparing against. If it is the same, pop it off and continue scanning, otherwise the pairs are mismatched and you have invalid data.
When you get to the end of the file, the stack should be empty, if not, then you also have invalid data.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Decare a CString variable to be your "stack" (or a CArray of type char )
Initialize it to be empty.
Write a function : void Push(char) which adds one character to the end of the CString.
Write a function : char Pop() which returns the character at the end of the CString then removes it (or returns an error value if the string is empty)
Now write a main loop that read in chars from your file one at a time.
1) If it finds a left brace, paren or bracket it must call Push(char) and add it to the string
2) If it finds a right brace, paren or bracket it must call Pop() and compare the result to the char just read in.
3) If it finds any other character ignore it keep looping :
In case 2) (right symbol read in from file)
If Pop() returns a matching left symbol it can carry on looping.
If Pop() returns a non-matching left symbol then the input was invalid.
If Pop() returns the error value because the CString is empty then the input was invalid.
If your reach the end of file with no previos fail:
Call Pop() and check for the error value (CString empty)
If the CString (your stack) is empty (Pop() returns error value) the input was valid.
If the CString (your stack) is not empty the input was invalid.
[edit]
I suggested the CString or CArray so you don't have to worry about memory management as the stack (whose max required size will be unknown) grows: If the exercise is intended to demonstrate your ability to allocate and free memory dynamically then you will need to use char* instead of CString/CArray and allocate an initial amount of memory for the stack and each time you add a char check to see if it needs more allocated.
[/edit]
Steve T
|
|
|
|
|
Ok, this is pretty much what i have so far....it works on some cases...but when i try to implement other strings, it gives me errors...here is the code i have so far...
<br />
#include <stack><br />
#include <fstream><br />
#include <iostream><br />
<br />
<br />
using namespace std;<br />
<br />
int main()<br />
{<br />
<br />
stack<char> charStack;<br />
<br />
char cChar;<br />
<br />
ifstream inFile;<br />
<br />
<br />
inFile.open("infile.txt"); <br />
<br />
if(!inFile) <br />
{<br />
cout<<"Input file does not exist."<<endl;<br />
return 1;<br />
}<br />
<br />
inFile>>cChar;<br />
<br />
while(inFile)<br />
{<br />
<br />
if (cChar == '{' || cChar == '[' || cChar == '(')<br />
{<br />
charStack.push(cChar);<br />
}<br />
<br />
else<br />
{<br />
if (charStack.top() == '(')<br />
{<br />
if (cChar == ')')<br />
{<br />
charStack.pop();<br />
}<br />
}<br />
else if (charStack.top() == '[')<br />
{<br />
if(cChar == ']')<br />
{<br />
charStack.pop();<br />
}<br />
}<br />
else if (charStack.top() == '{')<br />
{<br />
if(cChar == '}')<br />
{<br />
charStack.pop();<br />
}<br />
}<br />
}<br />
<br />
<br />
inFile>>cChar;<br />
}<br />
<br />
if(charStack.empty()) <br />
{<br />
cout<<endl<<"Valid"<<endl;<br />
}<br />
<br />
else <br />
{<br />
cout<<endl<<"Invalid"<<endl;<br />
}<br />
<br />
<br />
cin.get();<br />
<br />
return 0;<br />
<br />
}<br />
<br />
when i use these input files, I get a valid output....
<br />
input:<br />
{(a+5)-7*[1-{4/2}])/{2*(3-6)}
<br />
input:<br />
(((({[]})()()))){}
<br />
input:<br />
{{()}
and i get errors on the following
<br />
input:<br />
{()[()]}} <br />
<br />
input:<br />
{{a+5}-7*[1-{4/2}]}/{2*(3-6)}<br />
HELP!!!
|
|
|
|
|
rdt253 wrote:
and i get errors...
What errors?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I dont get any compile errors...but when I run stack.exe i get a windows error "stack.exe has encountered a problem and needs to close. We are sorry for the inconvenience. It then prompts me to debug, send error report, or ignore error report...
|
|
|
|
|
Step through the program one statement at a time...until it "crashes."
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
I'm working on a GUI interface that has worker theads. I want to be able to access data generated from the worker thread and display it on the GUI in real time. Right now, i'm able to access the data but I'm not able to display it until the thread finishes. Is there a way to access the data and display it in real time while the thread is running?
Thanks
Lien
|
|
|
|
|
What is preventing you from displaying it until after the worker thread has finished?
Is your UI thread waiting for the worker thread to finish? Are you storing your data on the worker thread in buffers that are accessible to the UI thread? What kind of data do you have, and how are you trying to display it on the UI?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Two ideas:
1- Have your worker thread post user messages to your GUI thread informing it about the current status.
2- Use a data structure that your worker thread and GUI thread both have access to. Be careful about data access synchronisation when using this approach.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Hi.. anyone help with some info to save a bitmap from the clipboard into a bitmap file?
|
|
|
|
|
if (OpenClipboard(NULL) != FALSE)
{
HBITMAP hBitmap = GetClipboardData(CF_BITMAP);
if (NULL != hBitmap)
{
}
CloseClipboard();
} [edit]
I just tried this and it works fine.
[/edit]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Hello,
I am thinking of getting either a VC++ 2003 .NET or VC++ 6. I have to write an FTP application that would work on the internet. I will very much appreciate if somebody could tell me what would be the best platform for this application: VC++ 2003 .NET or VC++ 6? And, if it is VC++ 2003, could somebody please tell me how adding handlers works in this platform?
Thank you,
Victor.
|
|
|
|
|
You may as well get the more up-to-date version. VC++ 2003 will do everything that VC++ 6 does plus more.
If you intend to use MFC then you should be aware that ClassWizard is no longer present but the online help explains how to add event handlers. Many think that the new way is less usable than the old way but, nevertheless, the functionality and features of the framework, as opposed to the IDE, are richer.
Kevin
|
|
|
|
|
Hi Kevin,
Thank you very much for the reply. I think I will get VC++ 2003.
Victor.
|
|
|
|
|
You might want to investigate the differences between the Standard and Professional editions though. You can get the Standard Edition by itself. But for the Professional Edition, you have to purchase the entire Visual Studio 2003 (or use the free command line compiler with no IDE! ). I don't know whether this is an issue for you or not. I'm not entirely sure what you lose if you just get VC++ 2003 Standard but I'm sure there must be a feature matrix somewhere.
Kevin
|
|
|
|
|
I believe the major difference is that the professional version is able to perform more code optimizations than standard. I personally have had no problem with the standard version.
|
|
|
|
|
Dear All, does anyone have UDP socket sample code to able to send and receive UDP? or anyone can explain how to:-
a) Write and send a programme to send a single datagram.
b) A program to receive the datagram sent by the program (a above)
c) A program to wait for the reply from b above (question b)
d) A way of timing how long it takes for a datagram to get from the first program to the second and back again, i.e measuring the RTTs of a datagram.
Thank you for looking into this.
Regards.
Kim
|
|
|
|
|
Hi i want to write a simple thread , that will work in the background and i'll be able to do other things in my program until the thread is in progress,i do the following but get an error.
UINT CtestDlg::MyThreadProc(LPVOID pParam)//create thread
{
for(int i=0;i<10000;i++)
for(int j=0;j<10000;j++) {};
MessageBox("Finished");
return 0;
}
then call it : AfxBeginThread(MyThreadProc,0);
but i get an error :
c:\...\ : error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'UINT (LPVOID)'
Can anyone help ?
Regards
Giorgi Moniava
|
|
|
|
|
|
use:
AfxBeginThread(&MyThreadProc, (LPVOID)this, THREAD_PRIORITY_NORMAL);
inside MyThreadProc you can add the code:
CtestDlg *pTestDlg = (CtestDlg *)pParam;
... this will allow you to access any CtestDlg members.
|
|
|
|
|
Thanks Greg for you attention , but when i type :
AfxBeginThread(&MyThreadProc,(LPVOID)this,0);
i get an error :
c:\..\: error C2276: '&' : illegal operation on bound member function expression
Regards
m0n0
|
|
|
|