Mail Archives: djgpp/1997/11/04/08:16:18
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
- Raw text -