|
Hi Divyang,
thanks so much. That solves the problem but, I can not believe there´s no straight way to do it.
|
|
|
|
|
Hi ,
When i include any header file in a cpp file May i know why the syntax is #include "test.h" why not #include <test.h> .Please let me know the difference...
|
|
|
|
|
<> will search in the include search path.
"" will also search the current directory in addition to the include search path.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
See [^]. BTW read posting guidelines [^].
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
[My articles]
|
|
|
|
|
which c++ book are you refering?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
My 5 .
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
[My articles]
|
|
|
|
|
<> is for windows header files and "" for your header files.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi all,
if i m using this code in Visual studio 2005 than its working fine but in case of visual studio 2008 its gives and exeception that is::
Unhandled exception at 0x755e21b3 in test.exe: 0xC0000005: Access violation reading location 0x0000000c.
code is like that,
SHELLEXECUTEINFOA TempInfo = {0};
TempInfo.cbSize = sizeof(SHELLEXECUTEINFOA);
TempInfo.fMask = 0;
TempInfo.hwnd = NULL;
TempInfo.lpVerb = "open";
TempInfo.lpFile = "calc.exe";
TempInfo.lpParameters = "";
TempInfo.lpDirectory = "";
TempInfo.nShow = SW_NORMAL;
BOOL tt= ::ShellExecuteExA(&TempInfo);
if(tt==TRUE)
{
AfxMessageBox("ShellExecute created successfully");
}
else
{
AfxMessageBox("ShellExecute not created");
}
please help me this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
In Mumbai, we step through the code with the debugger to resolve such issues (if I remember it right, they do the same at Rome, but I'll leave it to Carlo to confirm).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
It's ok, but what do you do in Bangalore? (In Milan, I suppose, they ask to a Rome-based developer to do the job).
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
[My articles]
|
|
|
|
|
CPallini wrote: In Milan, I suppose, they ask to a Rome-based developer to do the job
I suppose as long as someone uses the debugger, the job gets done.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Its workking on the VS2008 without any problem.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
i wrote the code below for a C++ programming class and i get a segmentation fault within this part of the code. now i asked my teacher and he told me that there's just a line in the wrong place but for the life of me i can't figure out which line is out of place. i thought i'd turn to some people with more experience with looking at code and finding the errors. it's really a simple problem i have i'm just not seeing it though.. please help me!
p.s. sorry if i posted the code the wrong way for the forum
void Search::Store(char *k, char *d) {
struct TBox *p1,*p2;
int i;
p1 = new TBox;
if (Start==NULL) {
p1->left = NULL;
p1->right = NULL;
p1->key = new char[strlen(k)+1];
p1->data = new char[strlen(d)+1];
strcpy(p1->key,k);
strcpy(p1->data,d);
Start=p1;
return;
p1=Start;
while(p1!=NULL) {
if ( (i=strcmp(k,p1->key)) == 0 ) {
delete [] p1->data;
p1->data = new char[strlen(d)+1];
strcpy(p1->data,d);
return;
}
if ( i < 0 ) {
p2=p1;
p1=p1->left;
continue;
}
p2=p1;
p1=p1->right;
}
}
p1 = new TBox;
p1->left = NULL;
p1->right = NULL;
p1->key = new char[strlen(k)+1];
p1->data = new char[strlen(d)+1];
strcpy(p1->key,k);
strcpy(p1->data,d);
Start=p1;
if (i<0) p2->left=p1;
else p2->right=p1;
return;
}
|
|
|
|
|
Brandon Ramirez wrote: p1->key = new char[strlen(k)+1];
p1->data = new char[strlen(d)+1];
strcpy(p1->key,k);
strcpy(p1->data,d);
Why didn't you check if memory allocation succeeded?
Brandon Ramirez wrote:
return;
p1=Start;
while(p1!=NULL) {
if ( (i=strcmp(k,p1->key)) == 0 ) {
delete [] p1->data;
p1->data = new char[strlen(d)+1];
strcpy(p1->data,d);
return;
}
What is the purpose of the return; line? Do you know the code below it will never be executed?
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
[My articles]
|
|
|
|
|
ok so what should i do with the return? yes i see that anything after it won't be executed but do i need to put that return at the bottom of this function or is it unecessary?
|
|
|
|
|
You didn't answer my question: What is the purpose of the intermediate return; ? Do you really want to cut-off the remaining lines? As for the return; at the bottom of the function, it is optional (old saying: "leave out all the optional stuff").
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
[My articles]
|
|
|
|
|
to tell you the truth i don't know why that was there i took it out but am still getting a seg fault from something. i can't tell what's doing it.
|
|
|
|
|
Brandon Ramirez wrote: to tell you the truth i don't know why that was there
That's not promising...
Brandon Ramirez wrote: am still getting a seg fault from something.
You should definitely use a debugger and find the offending line.
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
[My articles]
|
|
|
|
|
CPallini wrote: Why didn't you check if memory allocation succeeded?
Get with the times, man - new throws when it fails...so long as you're not using VC6! Certainly, in VC++ 2003 and later, this code prints Whoops - not enough memory! :
try
{
int* a = new int[1e9];
}
catch(std::bad_alloc)
{
std::cout << "Whoops - not enough memory!\n";
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you.
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
[My articles]
|
|
|
|
|
How do you know the problem lies within this code snippet?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
MFC, STUDIO 2008, MDI-project
If to comment
СAdderDialog* m_pModeless5;
then OK!
// modeldlg.h : implementation file
protected:
СAdderDialog* m_pModeless5; // pointer on class
error C2143: syntax error : missing ';' before '*'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
: error C2614: 'CMainDlg' : illegal member initialization: 'm_pModeless5' is not a base or member
class CAdderDialog : public Cdialog
class CMainDlg : public Cdialog
// adderdlg.cpp : implementation file
#include "stdafx.h"
#include "ADO_MDI.h"
#include "Aadderdlg.h"
#include "modeldlg.h"
// modeldlg.cpp : implementation file
#include "stdafx.h"
#include "ADO_MDI.h"
#include "Aadderdlg.h"
#include "modeldlg.h"
|
|
|
|
|
CHIVOTIOV wrote: #include "Aadderdlg.h"
Any typo there?
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Forward declare class СAdderDialog before class declaration;
class СAdderDialog;
Regards,
Paresh.
|
|
|
|
|
Typo: #include "Aadderdlg.h" //"a" too much
for class #include СAdderDialog
Press F1 for help or google it.
Greetings from Germany
|
|
|
|