|
Are you sure this is not a typo and it should be the conditional operator?
ilist_item *next = _current<br />
<< _current ? _current->next()<br />
: _current;
That does not look correct either, but it depends on the code, i.e. if _current != NULL go to the next node, otherwise return NULL
Of course I could be wrong
"The greatest mistake you can make in life is to be continually fearing you will make one." - Elbert Hubbard
|
|
|
|
|
I don't know if it is right
I only got it from a book "C++ Primer 3rd"
It is in sector 5.11.1
|
|
|
|
|
|
Yes
It is
Only my book is translated into chinese.
Those code may be found in A Linked List Example of chapter 5 Statements
Great!
Thanks!!!
|
|
|
|
|
The code is extracted from the function below:
inline ilist_item*
ilist::
next_iter()
{
ilist_item *next =_current
<<_current = _current->next()
:_current;
}
Mavbe the right is as you said, that is a conditional operator:
inline ilist_item*
ilist::
next_iter()
{
ilist_item *next =_current ? _current = _current->next() : _current;
}
Do you think so?
Thanks for your answer!!!
Happy 2004!!!
|
|
|
|
|
I can't say 100%, the simple test is to try and compile the code and step through using the debugger.
What I think it is, is a class to iterate through a linked list, where _current is the current node, next_item() checks if _current has been defined is so get the next node, otherwise return _current , which I asuume is NULL
Isn't C++ fun!
"There is no monument dedicated to the memory of a committee." - Lester J. Pourciau
|
|
|
|
|
Yeah!
C++ is very fun
and it is abundant in perfect thinking!
|
|
|
|
|
it is accessing the constructor (maybe) of that object.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
The code is extracted from the function below:
inline ilist_item*
ilist::
next_iter()
{
ilist_item *next =_current
<<_current = _current->next()
:_current;
}
Mavbe the right is as Mr. Ted Ferenc said:
inline ilist_item*
ilist::
next_iter()
{
ilist_item *next =_current ? _current = _current->next() : _current;
}
Do you think so?
Thanks for your answer!!!
Happy 2004!!!
|
|
|
|
|
You know.. that subject line sure looked suspicious for a forum like this.
--
They say the most horrible things, but I hear violins.
When I close my eyes, I'm at the center of the sun.
|
|
|
|
|
We don't have a medical forum yet, Jörgen.;P
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
True. I figure this forum can only treat missing semicolons and related issues.
--
They say the most horrible things, but I hear violins.
When I close my eyes, I'm at the center of the sun.
|
|
|
|
|
Good night and happy New Year.
Excuse my English as it's not my languaje.
My problems are two: I've just began learning VC++ on my own and I need to send a file using ZModem protocol.
I have searched for some code to learn from, but all I found was for Unix and wasn't commented or documented, so that and nothing is more or less the same.
Could someone explain something practical (not history or comparatives with other protocols) about zmodem or tell me where I could find a ready to use c++ class or activeX.
One more solution would be automating Hyperterminal, but i don't know if it's possible and as I said, I'm a beginner at VC++.
Any info is wellcome.
Thanks.
|
|
|
|
|
I did a search on Google[^] using the words "ZMODEM" "C++" "source" and "Windows", and came up with a large number of hits. Take a look and see if any of those fit your needs.
Software Zen: delete this;
|
|
|
|
|
I would like to understand how you can print the string from an edit box using dcPrint?
Example: dcPrint.TextOut(50,150,Editbox string here);
anyhelp greatly appreciated
ThankYou in advance.
Still no advice on how to achive this, does anyone have any sugestions that I might try?
|
|
|
|
|
hi,
ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
printing goes like this
void CMyDialog::OnFilePrint()
{
CString strValue;
int iRet;
CPrintInfo Info;
//set your info flags
PRINTDLG pdsetup;
HDC hdc;
//get your hdc from pdsetup
CDC dc; //dcPrint???
//Attach hdc with dc
//set drawing rect
//call OnPreparePrinting(&Info);
//call OnBeginPrinting(&dc, &Info);
DOCINFO docInfo;
// make your docinfo if needed
//iRet = dc.StartDoc(&docInfo);
//iRet = dc.StartPage();
//OnPrepareDC(&dc, &Info);
myEditBox.GetWindowText(strValue);
dc.TextOut( 200, 200, strValue); //place own coordinates
//dc.EndPage();
//dc.EndDoc();
//OnEndPrinting(&dc, &Info);
//dc.Detach();
hope it helps
dan
|
|
|
|
|
I'm trying to create a very simple diagnostic utility for Win98. In VC++ with MFC, how do I found out the numeric IP address of the computer on which the program is running?
|
|
|
|
|
One way is to call gethostname() followed by gethostbyname() .
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Thank you but that seems to only get me the domain name. I'm trying to get the IP number so that I can track when the DHCP assigns a new one.
|
|
|
|
|
I'm not sure what your code looks like, but gethostname() and gethostbyname() is for getting the IP address of the host machine (i.e., the machine running the application).
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
What exactly does the line:
rGfxOptionsWnd* m_pGfxOptionsWnd;
do?
I have chased this bug and narrowed it down to something that I believe should not happen and I don’t even know what could possibly cause it to happen.
My basic application structure is simple.
An Application Class,
An App Class derived from the Application Class
The application class has a member varible which is a Paramater class
e.g.
Application {
Public:
Param_class m_Params;
};
In it’s constructor Application instalises m_Params values.
<code> m_Params.Window.bWindowed = false;
m_Params.Window.width = 500;
m_Params.Window.height = 500;
m_Params.Window.icon = NULL;
m_Params.Window.title = "rDirectXApp Default Window Title";
m_Params.Window.wnd_type = RJM_WNDT2;
m_Params.Window.res_x = 0;
m_Params.Window.res_y = 0;
m_Params.Window.esc_to_quit = true;</code>
In it’s Constructor, App (Derived from Application) then alters some of the values as nessecary.
<code> m_Params.Window.icon = (const char *) IDI_ICON1;
m_Params.Window.title = "Super Game in this window!!!";
m_Params.Window.bWindowed = true;
m_Params.Window.wnd_type = RJM_WNDT5;
m_Params.Window.width = 600;
m_Params.Window.height = 300;
m_Params.Window.bWindowed = true;
m_Params.Window.res_x = 100;
m_Params.Window.res_y = 100;</code>
Now I can compile and run this code perfectly. I have set break points on each line shown here and I can watch the values as they go through this process and change.
I have another completely empty class, just an empty constructor and destructor.
RGfxOptions. I add the following line into Applications private section:
rGfxOptionsWnd* m_pGfxOptionsWnd;
With this line in the program I run the debug version of the program.
The Application constructor sets up m_Param exactly as it’s supposed to.
Control then passes to App’s constructor.
When: m_Params.Window.icon = (const char *) IDI_ICON1;
executes, m_Param.Height changes (nothing else)
when m_Params.Window.title = "Super Game in this window!!!";
executes, m_Params.title changes but the new value is corrupt
when m_Params.Window.bWindowed = true;
executes, nothing in m_Params alters
when m_Params.Window.wnd_type = RJM_WNDT5;
executes, nothing
when m_Params.Window.width = 600;
executes bWindowed alters
when m_Params.Window.height = 300;
executes, width alters
when m_Params.Window.bWindowed = true;
executes, nothing
when m_Params.Window.res_x = 100;
executes, wndtype alters but to an invalid value
and after m_Params.Window.res_y = 100;
the program crashes because of the invalid data.
But with the line:
rGfxOptionsWnd* m_pGfxOptionsWnd;
remmed out it all works perfectly.
Can anyone help? What does that line do? How is it possible that the statement altering the height actually alters the width member variables? I havn’t used or refered to m_pGrgOptionsWnd anywhere at all in my code. How can simply adding a pointer member varible to my class have this effect?
Thanks in advance for any suggestions. I have absoultly no ideas at the moment at all!
---
Posted By Robert Metcalf
|
|
|
|
|
My bet is that you need to do a rebuild-all. The line added just adds an extra 4 -bytes (a pointer) to the size of your object. If its declared before the m_Params member, then m_Params is now offset by an additional 4 bytes. If your .cpp file(s) have not been completely rebuilt since this declaration change, you may find that one file is using the old declaration and another the new one. This will cause assignnments etc to change the wrong members of m_Params.
To check this, move the declaration of m_pGFx... to after m_Params
Or just force a rebuild all
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Hello-
I would like to use a very simple XML description to layout some customizable dialogs in an application. I was hoping I could find a relatively simple XML parser available as open source.
I looked at Xerces and although it would certainly do the job, it is far more complicated than necessary. Any suggestions?
Jake
|
|
|
|
|
|
or try searching for
CMarkup (Here on CP For Developers version, from FirstObject)
pugXML (Here on CP)
both are 'tiny' and do great job
'G'
|
|
|
|