Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / April 2007

Tip: Looking for answers? Try searching our database.

tracking handle

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
manjub - 22 Apr 2007 09:34 GMT
Hi,

I have a question regarding a reference to tracking handle.

In older C++ if I write below code would add new node to the linked
list.

Object* o = linkList->FirstNode;
while ( o != null ) {
    o = o->nextNode;
}
o = newNode;

However in Visual C++ 2005.NET, I wrote the following code and it does
not add a new node to linked list.

Object^ o = linkedList->FirstNode;
while ( o != nullptr ) {
    o = o->nextNode;
}
o = newNode;

Is there a way to correct this. Am I missing something?

Regards
Chris Taylor - 22 Apr 2007 11:06 GMT
Hi,

As you have it, the C/C++ version would not work either. After the while
loop, o is null and has no relation to the original list. The following
would probably do what you want

while ( o->nextNode != null )
{
   o = o->nextNode;
}
o->nextNode = newNode;

Hope this helps

Signature

Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor

> Hi,
>
[quoted text clipped - 21 lines]
>
> Regards
manjub - 23 Apr 2007 03:43 GMT
Thanks a lot for your help. It seems to work.

On Apr 22, 3:06 am, "Chris Taylor" <chris_taylor...@hotmail.com>
wrote:
> Hi,
>
[quoted text clipped - 38 lines]
>
> > Regards

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.