| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Need to copy |
JM> I received a program which uses memcpy to copy from one variable to
JM> another which are built on the same structure. Other than doing the
JM> copy the hard way, what function can I use?
With C++, just use the assignment operator. For POD structures, this
performs a memberwise copy.
struct A {
int i ;
long l ;
} ;
A a = { 1, 2 } ;
A b = { 3, 4 } ;
b = a ;
¯ JdeBP ®
--- FleetStreet 1.19 NR
* Origin: JdeBP's point, using Squish (2:440/4.3)SEEN-BY: 396/1 632/0 371 633/210 260 267 270 371 635/506 728 639/252 670/218 @PATH: 440/4 255/1 251/25 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.