|
3. Is there any difference in #define MAX 30 & const int max=30;?
5. How to use free in that case?
|
|
|
|
|
Aniket Salunkhe wrote: 3. Is there any difference in #define MAX 30 & const int max=30;?
Yes. #define MAX 30 just replaces each occurance of MAX in the code with 30 before it's compiled, const int max=30; declares a variable which will exist at runtime. In the first case int* pInt = &MAX; would give a compiler error in the second int* pInt = &max would be fine.
Aniket Salunkhe wrote: 5. How to use free in that case?
I can't honestly remember, it's years since I used calloc in anger. You'll need to either look at the docs or in the MS C Runtime source which ships as an optional install component with Visual Studio. Every memory allocation function e.g. malloc, calloc, has a specific matching from of free and it's especially important to match them up in Debug builds where they get mapped to diagnostic versions of the functions otherwise you'll get spurious leak reports and heap damaged block reports from the allocation tracking that is added to the debug functions. The CRT memory functions are a tangled multilayer mess, especially in Debug builds and it's not easy to track down the causes of problems after they've occured.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thank You Very Much
|
|
|
|
|
dear all
after i followed the book what it explained us how to use set left and right, but however after i set it, still problem. anyone can tell me detail, thanks
#include <iomanip>
using std::left;
using std::right;
using std::cout;
using std::endl;
for example: cout <<left<<name<<endl;
Li Zhiyuan
|
|
|
|
|
What is your problem?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
after i set left,output value can't be lefted by one column
Li Zhiyuan
|
|
|
|
|
Not sure I've understood. Could you please post an example?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
for example:
cout << setw(3)<<kk<<left<<setprecision(2)<<name<<endl;
but the output is still as follows:
1 jok
2 nice
.
.
.
10 mike
actually here name mike has same line with nice, jok..but mike is further front...
another question is setw(3), also couldnot work properly..no space display
Li Zhiyuan
|
|
|
|
|
If I understand your requirements then you probably need:
cout << right << setw(3)<< kk << " " << left << name << endl;
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
thanks, i did like this before, could you provide me with detail step by step, thanks a lot. in vc++ 2005 format.
Li Zhiyuan
|
|
|
|
|
I posted a line of code. What details and steps do you need about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi..
Just wanted some info on ways to automate VC++ builds. I am using Visual Studio .NET 2003.
Maybe some command line switches of devenv.exe ?
Regards
Amit
|
|
|
|
|
|
Thanks a ton Haroon! I was able to do my job
|
|
|
|
|
cagespear wrote: Just wanted some info on ways to automate VC++ builds.
Maybe some command line switches of devenv.exe ?
Yes. Thats the easiest way to go.
Alternatively, you could use a totally different build system like Microsofts nmake, scons or jam.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
As you mentioned it, have you ever got Jam to work? I tried it for building the Boost library and couldn't get anywhere with it. Do you perhaps know of any good tutorials for it?
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Matthew Faithfull wrote: As you mentioned it, have you ever got Jam to work?
Actually, no.
But it pops up in every review on build systems.
We used SCONS, and it worked.
Now, we are more and more switching to .NET and NANT.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Thanks, I'll check out SCONS at some point.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
You know this review[^]?
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Nice article, thanks. I guess I'm not the only one who's had trouble with Jam then. Unfortunately I hate and am hopeless with make as well which is really disabling me from doing proper cross platform development. I guess I'm going to have to spend some time with a hefty make tutorial and write my own front end...Hmm XML to make using a recursive decent parser ... Visual Studio solution to platform indpendent XML using XSLT ... Visual Studio AddIn to export ... GCC build for MinGW ... next time I've got a spare month
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Wow! You have given a lot of stuff to read/know about, thanks dude!
|
|
|
|
|
hi
i have a application when i click the close button(X) , it must goes to the tray but it should be running ...
(i did a project when i click minimize button(_) it goes to tray . it is perfectly working)
k.guru moorthy
|
|
|
|
|
Have you tried to handle the WM_CLOSE event and write your code to send your application to tray there?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hi,
I have a modal dialog with two edit boxes, one of them read-only, and a button. I want to transfer the integer written into the first to the second when the button is pressed.
I have added variables(int iVar, iCalcValue) to the edit-boxes and an event handler to the button, but I don't know where and how to write the data update code so the value is shown on the screen.
Sorry for such a silly question, I'll get better after some time
Thanks
|
|
|
|
|
Call UpdateData(true) before you read value from the control and update the member variable. Call UpdateData(false) before you update the control on the screen to reflect the value of the member variable.
UpdateData(true);
m_edit2 = m_edit1;
UpdateData(false);
Remember that UpdateData() will update the state of every other control and member in your dialog as well.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
modified on Tuesday, February 12, 2008 4:49 AM
|
|
|
|