|
Please read the gudelines[^] and reformat your post so the code is within <pre></pre> tags and correctly indented. That way we can read it. Secondly try to add a question, as this entry is meaningless.
MVP 2010 - are they mad?
|
|
|
|
|
wbgxx wrote: list* pp=new node;
You might start here.
Once you get that corrected, you should do some serious cleanup to the create() function. No screen I/O should be performed in that function. Prompt the user for input elsewhere and pass that data to the create() function.
Also, the call to new inside the while() loop is wrong.
Is each new node added to the front of the list or the rear? If the front, no while() loop is necessary. If the rear, the while() loop should simply iterate each node until NULL is reached.
"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
|
|
|
|
|
Hiiii to all
I wanna know the difference between the
return(0);
return 0;
return;
from a function call...... return(0) and return 0 is same or not ??
Thanking you
--------------
|
|
|
|
|
krish_kumar wrote: return(0) and return 0 is same or not ??
Yes, it is the same. The parenthesis are here just useless.
But, there's a difference between return; and return 0; : the first one is used in a function that returns nothing (void) and the second in a function that returns something (here, probably an integer).
|
|
|
|
|
krish_kumar wrote: return(0) and return 0 is same or not
Yes, exactly the same. The addition of brackets makes no difference.
krish_kumar wrote: return;
This however is totally different, and only valid in a "void" function - i.e. one which doesn't return a result.
The difference between them can be illustrated as :-
int DoSomething_1(int val)
{
return (0);
}
void DoSomething_2(int val)
{
return;
}
Days spent at sea are not deducted from one's alloted span - Phoenician proverb
|
|
|
|
|
molesworth wrote: void DoSomething_2(int val){ // some processing // ... return; // must not return a value as it's a "void" function}
isn't it:
molesworth wrote: void DoSomething_2(){ // some processing // ... return; // must not return a value as it's a "void" function}
[Edit] sorry for the layout...
|
|
|
|
|
Er, no.
A "void" function describes what it returns, rather than the number of parameters it has.
Graham
Librarians rule, Ook!
|
|
|
|
|
Thanks Graham, I was just about to say that...
Days spent at sea are not deducted from one's alloted span - Phoenician proverb
|
|
|
|
|
To build a solution, you can simple pass in the path to the solution file and optionally a configuration, such as debug or release. Projects are compiled by using the Project switch, and you can build one project at a time, also optionally specifying the configuration to use.
The syntax to use is:
devenv solutionfile.sln /build [solutionconfig]
[/project projectnameorfile [/projectconfig name]]
My question is,
1)if we dont specify configuration either "debug" or "release" as it is optional, will it build both debug and release or any one (debug or release) by default.
2) Any idea how to build both "debug" and "release" in one command line.
Thanks,
Nandu
|
|
|
|
|
Nandu_77b wrote: 1)if we dont specify configuration either "debug" or "release" as it is optional, will it build both debug and release or any one (debug or release) by default.
What happens when you try?
Nandu_77b wrote: 2) Any idea how to build both "debug" and "release" in one command line.
No, but there may be some suggestions here[^].
MVP 2010 - are they mad?
|
|
|
|
|
I don't use the devenv program, but from a batch file I use something like this:
vcbuild /r /useenv \Source\Mapp\bld\myapp.sln $ALL
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
We have several exes that need access to common dialogs for database administration on common tables. Dialogs need access to a database via ADO/ODBC and user interface. We have in the past recreated the same dialog repeatively. Getting tired of doing that. Would like to create for each dialog an EXE/DLL or something that we can link at runtime in case of changes. A DLL looks like the best way. Any BOOKS or PUBLICATIONS out there to exactly guide us from creating , calling from current EXEs, and distribution? Really need step by step not just a reference document. Would just creating an EXE for each dialog and shell execute would work? Pros / cons.
thank you
|
|
|
|
|
|
(If you're using MFC) We had a similar problem, and eventually, after lots and lots of deliberation, we opted for a non-portable solution, where the DLL with the dialogs export the entire CDialog classes, using the __dllexport keyword in the class declaration. Code won't be reusable by any other platform or compiler, but it works... You could pass in a CDatabase or what have you to the dialog constructor.
|
|
|
|
|
Hello, I'm having a very difficult time changing parameters using code to a program that has a few labels. I was able to move their position, change their color, but unfortunately not their sizes. This project also uses ActiveX. I'm using VS 2008, and the only articles that give any insight are all for VS 6.
m_lblctrl1.SetWindowPos(&wndBottom,0,0,0,0,SWP_NOSIZE);
changes m_lblctrl1 position (x,y,cx,cy)
m_lblctrl1.SetForeColor(RGB(255,0,0));
changes m_lblctrl1 to red.
m_lblctrl1.SetFont(LPFONTDISP);
now this is where i've been hitting a very bad wall
this is the method i've been tackling.
CFont font;
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
lf.lfHeight = 12;
strcpy_s(lf.lfFaceName, "Arial");
VERIFY(font.CreateFontIndirect(&lf));
m_lblctrl1.SetFont(&lf);
the error i'm getting is "error C2664: 'CLabel::SetFont' : cannot convert parameter 1 from 'LOGFONT *' to 'LPFONTDISP' " I've done all the research i could do to properly troubleshoot this, but unfortunately i've hit the point where i need professional help. m_lblctrl1 is defined as a CLabel in case that helps. Also i used Do Data Exchange from the original label defined:
DDX_Control(pDX, IDC_LBLCTRL1, m_lblctrl1);
If anyone has experience with this LPFONTDISP and how to change the label size/font, i'd greatly appreciate help.
Thank you for any input, if there is any details i left out, I'd gladly add it.
-David
|
|
|
|
|
Dragondima wrote: m_lblctrl1.SetFont(&lf);
Why don't you use
m_lblctrl1.SetFont(&font);
?
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]
|
|
|
|
|
Hey, thanks for the reply!
I tried this earlier, and got the same "error C2664: 'CLabel::SetFont' : cannot convert parameter 1 from 'CFont *' to 'LPFONTDISP'"
|
|
|
|
|
OK. Now I'm aware your CLabel is an ActiveX control. You have to use OleCreateFontIndirect [^].
Sample code here.
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]
|
|
|
|
|
Thanks for the reply!
I'm having a hard time getting the exgrid.dll to work, their examples give me a lot of errors. This was more for VS 6 i'm using 2008. I don't know if this would make a difference, i downloaded the file, but haven't had much success. Other suggestions would be greatly appreciated!
|
|
|
|
|
Hi
I need to read and save a class instance pointer.
class A
{
}
A* pClassA = new A(); I want to read and save "pClassA" from and to a file. What kind of data type it is? How many bytes it will take?
I am using CFile to do file IO.
Best regards,
modified on Thursday, January 21, 2010 9:15 AM
|
|
|
|
|
Saving a pointer doesn't make any sense. A pointer is merely a memory address, how useful would that be ?
What you probably want to do instead is save the content of your object to the file. In that case, you will need to save each member variables separately.
I suggest you take a look at this article[^] (and the full series) to have a better understanding of serialization.
|
|
|
|
|
Usually, that make no sense: a pointer contains the address of an object, so what is the purpose of storing it? If you need to store the class instance (i.e. the object itself) then you should look at serialization (Serialization on Wikipedia, Serialization in MFC).
Ah, of course the size of the pointer pClass is
sizeof(pClass)
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]
|
|
|
|
|
Hi I all a newbie here. need help with this:
char *strtok( char *str1, const char *str2 );
char str[] = "now # is the time for all # good men to come to the # aid of their country";
char delims[] = "#";
char *result = NULL;
result = strtok( str, delims );
while( result != NULL )
{
printf( "result is \"%s\"\n", result );
result = strtok( NULL, delims );
}
for char str[] , how can i assign it to a variable b? so far i get this error:
readin.cpp:34: error: initializer fails to determine size of ‘str
Thanks alot.
|
|
|
|
|
xivShin wrote: char *strtok( char *str1, const char *str2 );
What's the purpose of the above line?
xivShin wrote: char str[] = "now # is the time for all # good men to come to the # aid of their country"
Is the compiler complaining of the above line? Strange! What compiler are you using?
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]
|
|
|
|
|
first address the issue pointed out by the esteemed CPallini
then, try either
char str[74] = "now # is the time for all # good men to come to the # aid of their country";
or
char * str = "now # is the time for all # good men to come to the # aid of their country";
|
|
|
|