|
I'm a student of a university in Viet Nam. I'm working my project which is my home word. My teacher request me write a program as Total commander. But I don't know how to write. If you know or you have it, can you share for me ?
Help me. please. thanks!
|
|
|
|
|
No, if indeed you are a student, do your own homework. No one here is going to send you source code for anything.
The wonderful thing about the Darwin Awards is that everyone wins, especially the members of the audience.
|
|
|
|
|
ok. so I do it by myself, thank you reply.
|
|
|
|
|
You *could* try and get your money back as you clearly haven't learned anything.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
thanhkhanhcntt wrote: But I don't know how to write
That's why this[^] wonderful site was developed, just enter the kind of code you want and you email address and they do the rest!....free no less!
|
|
|
|
|
|
What is not working ? Compilation errors/warnings ? wrong values ? crash ?
Is it a typo that your first include line is commented out ?
Watched code never compiles.
|
|
|
|
|
no the code is compiling in visual studio but it got stuck i am working on this from past 2 days and ots not working that the producer is producing but consumer is not consuming and according to logic it must be random but when producer produces 10 times code get halt and no consumer work i am very new to this language if you can help then it will be appreciated....
please help
|
|
|
|
|
It may help if you post your code using "code block" style with proper indention -- something like this
int main()
{
int buffer[NUM];
int start;
int end;
int PTemp;
int CTemp;
int full,empty;
int dataNum;
int np,nc,finished;
double time_start;
PTemp=CTemp=start=end=full=dataNum=np=nc=finished=0;
empty=1;
....
}
People will be more willing to read your code like this than what you posted.
|
|
|
|
|
hello i am new to this so sorry for that but if you can correct it then it will be a great help i have even made the win32 threads code of this producer consumer problem in c++ which is working but open mp one is not working so help me in this if you want then i can even post the win32 threads code
|
|
|
|
|
aruneshjoshi wrote: #pragma omp section nowait //producer's code
Should this be:
#pragma omp sections nowait // producer's code
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
thanks for your help but still code is not working
|
|
|
|
|
You might get the help you need if you join the OpenMP forums and post your question there. All the best OpenMP experts are there to help you, including the folks who created the OpenMP API.
http://openmp.org/forum/[^]
|
|
|
|
|
I am wondering if the type passed to delete[] needs to be the same as the type allocated by new? I am attempting to do the following:
void** memPoolPtrs = new void* [4 * (1 + 12)];
double* memPoolData = new double[4 * 12 * 30];
double*** myData = reinterpret_cast<double***>(memPoolPtrs);
memPoolPtrs += 4;
for (size_t idx0 = 0; idx0 < 4; ++idx0) {
myData[idx0] = reinterpret_cast<double**>(memPoolPtrs);
memPoolPtrs += 12;
for (size_t idx1 = 0; idx1 < 12; ++idx1) {
myData[idx0][idx1] = memPoolData;
memPoolData += 30;
}
}
delete[] **myData;
delete[] myData; Is there any risk in the above approach (other than allocating things of improper size)? I can't think of a reason why such a thing wouldn't work, but I am curious if the two delete statements will work as I anticipate. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
modified on Friday, April 16, 2010 12:41 PM
|
|
|
|
|
Since the delete operator takes a void* type, it doesn't matter what type is passed for deletion as long as it is the starting address of the allocation.
|
|
|
|
|
For yor case it works.
As a general rule it won't.
delete[] against an object, whose type has a destructor will call the 'vector deleting destructor', which will call the destructor for each element.
The problem is the number of elements.
When new[] is called on a type with a destructor:
1. malloc a block large enough to hold the reqested # of elements, the actual block size will be rounded up to some grain size.
2. store the actual block size (bytes) with the block for free().
3. store the requested # of elements with the block so delete[] can iterate over them and call ~().
When you call delete on a different (sized) type the # of elements stored with the block will be wrong and you will either call ~() on too few or too many elements.
If too few then you could have a memory leak if the destructor frees resources.
If too many then you corrupt the heap.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Yes if the destructor is not virtual, no if it is. Delete will take any type, but it will only call the appropriate destructor if it is virtual or if you pass it as the correct type.
|
|
|
|
|
dear all,
i have created one SDI application and i need to include one table (just like how we insert table into ms word document).
is it possible? if yes please let me know..
thanks in advance.
AK
|
|
|
|
|
Khathar wrote: is it possible? if yes please let me know..
Yes it's possible.
have a look at MFC Grid control 2.26[^].
Watched code never compiles.
|
|
|
|
|
|
Hello,
i try to write large text in to CComboBox field, but the max text length is limited by the CComboBox width !!!
But i need to imput larger text as the width of the combo box, when i write my text, the cursor moves to the right!!??
If i read large string from a file, this can be showed in the combo box, only if i try to write them by my self its limited!?
Can any one help me how to solve this??
Thanx for any help!
Arrin
|
|
|
|
|
Sorry
i solve this, its simple setting on the properties CBS_AUTOHSCROLL
Arrin
|
|
|
|
|
Hi All
I am useing worker thread in Dialog base Application.In Dialog I have a Static Control and Button.I try to set some values in Static Control.I have got some GUI Error application and CtlColor color change auto.As well as Control move from fixed position.I am doing like this
CWinThread *Testing;
UINT InsertThread ( LPVOID p );
UINT InsertThread ( LPVOID p )
{
CTestDlg *Get=( CTestDlg *)p;
Get->Example();
return 0;
}
void CTestDlg::OnBnClickedButton4()
{
Test = AfxBeginThread(InsertThread, (LPVOID) this,THREAD_PRIORITY_NORMAL,0,0);
}
void CTestDlg:: Example()
{
int count=0;
For(int i=0;i<10000;i++)
{
Count++;
CString show="";
show.Format("%d",count);
m_showvalues.SetWindowText(show);
}
}
I also use
OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) and OnEraseBkgnd(CDC* pDC) for change background color(Dialog and CtlColor).
How can i solve GUI Problem?
Please help me.
|
|
|
|
|
MsmVc wrote: How can i solve GUI Problem?
Never never access GUI elements in another thread than the GUI thread. This is a recipe for disaster. One way to solve your problem is instead to access the static control directly in your thread, you simply send a user defined message to your dialog. In the handler of this message, you update your control. This way, this is the UI thread that still accesses the control. More info and examples here[^]
|
|
|
|
|
MsmVc wrote: How can i solve GUI Problem?
You could pass the HDC and the client rectangle of the static control at your thread
to draw (only) there from the thread directly...
virtual void BeHappy() = 0;
|
|
|
|