From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) Newsgroups: comp.os.msdos.djgpp Subject: Re: Beginners Question Date: 3 Nov 1997 07:41:01 GMT Organization: The National Capital FreeNet Lines: 24 Message-ID: <63jv6d$pm8@freenet-news.carleton.ca> References: <3458C5E6 DOT 47D7 AT bergen DOT mail DOT telia DOT com> <345D12BC DOT 3A413314 AT alcyone DOT com> Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) NNTP-Posting-Host: freenet5.carleton.ca To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Erik Max Francis (max AT alcyone DOT com) writes: > john kismul wrote: > >> I've allocated some memory with malloc. >> >> How do I transfer data from this memory to somewhere else in memory, >> such as, someother memory I've allocated or an array. > > Depends on what kind of information is being stored there. > > If it's a fundamental datatype, you can just use assignment. If it's > allocated as structures, you can use structure assignment. If it's a > NUL-terminated string, you can use strcpy. If it's an arbitrary block > of memory, you can use memcpy. If it's a C++ object that is a model of Assignable, use assigment. Else, use copy constructor if any, else use sizeof and memcpy. -- .*. Where feelings are concerned, answers are rarely simple [GeneDeWeese] -() < When I go to the theater, I always go straight to the "bag and mix" `*' bulk candy section...because variety is the spice of life... [me] Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh