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++ / June 2005

Tip: Looking for answers? Try searching our database.

Copy a Structure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pravin Prabhu - 21 Jun 2005 06:33 GMT
Hi ,
     in C, How do I copy a contents of a Structure pointer to a Structure
Variable. e.g
     struct A var1;
     struct A *Var2;

I want to copy contents of Structure pointed to by Var2 to a Structure var1.
Is there any standard library function to do the same?

Thanks and Regards,
Jochen Kalmbach [MVP] - 21 Jun 2005 07:11 GMT
Hi Pravin!

>       in C, How do I copy a contents of a Structure pointer to a Structure
> Variable. e.g
>       struct A var1;
>       struct A *Var2;

var1 = *Var2;

Signature

Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/

Pravin Prabhu - 21 Jun 2005 10:50 GMT
Thanks Jochen,
                     var1=*var2 will copy the contents of structure pointed
to by var2 into var1. One more thing I wanted to ask was how do I copy the
contents of the structure var1 into the structure pointed to by var2?
       var2=&var1 will make var2 point to the var1 struture.

thanks again,

> Hi Pravin!
>
[quoted text clipped - 4 lines]
>
> var1 = *Var2;
Hendrik Schober - 21 Jun 2005 10:56 GMT
> Thanks Jochen,
>                       var1=*var2 will copy the contents of structure pointed
> to by var2 into var1. One more thing I wanted to ask was how do I copy the
> contents of the structure var1 into the structure pointed to by var2?
>         var2=&var1 will make var2 point to the var1 struture.

 *Var2 = var1;

> thanks again,

 Schobi

> [...]

 Schobi

Signature

SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

"Coming back to where you started is not the same as never leaving"
Terry Pratchett


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.