Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #3694

Re: Simple structure and copying data to pointer of the same structure

From "Thomas J. Gritzan" <phygon_antispam@gmx.de>
Newsgroups comp.lang.c++
Subject Re: Simple structure and copying data to pointer of the same structure
Date 2011-04-14 18:21 +0200
Organization news.netcologne.de
Message-ID <io76tv$769$2@newsreader5.netcologne.de> (permalink)
References <io73lj$7tl$1@gregory.bnet.hr> <9u4eq6p6fraig36r02fddfstuj74stscd4@4ax.com> <io74pd$9ru$1@gregory.bnet.hr> <io75u2$6q9$1@newsreader5.netcologne.de> <io76j2$d1c$1@gregory.bnet.hr>

Show all headers | View raw


Am 14.04.2011 18:15, schrieb A:
>> Instead of
>>     memcpy(pWhatever,&MyVect[0], sizeof(TWhatever));
>> you can do:
>>     *pWhatever = MyVect[0];
>
> ok, that worked too :)
>
> but it copies data right? it doesn't just change memory pointer points to?

Yes.

pWhatever = &MyVect[0]; // this assigns the *pointer*
*pWhatever = MyVect[0]; // this assigns the object; i.e. all of its data

-- 
Thomas

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Simple structure and copying data to pointer of the same structure "A" <a@a.a> - 2011-04-14 17:25 +0200
  Re: Simple structure and copying data to pointer of the same structure cg_chas <cg_chas@hotmail.com> - 2011-04-14 11:38 -0400
    Re: Simple structure and copying data to pointer of the same structure "A" <a@a.a> - 2011-04-14 17:44 +0200
      Re: Simple structure and copying data to pointer of the same structure "A" <a@a.a> - 2011-04-14 17:55 +0200
        Re: Simple structure and copying data to pointer of the same structure cg_chas <cg_chas@hotmail.com> - 2011-04-14 11:57 -0400
        Re: Simple structure and copying data to pointer of the same structure "A" <a@a.a> - 2011-04-14 17:59 +0200
          Re: Simple structure and copying data to pointer of the same structure cg_chas <cg_chas@hotmail.com> - 2011-04-14 12:06 -0400
          Re: Simple structure and copying data to pointer of the same structure "Thomas J. Gritzan" <phygon_antispam@gmx.de> - 2011-04-14 18:09 +0200
          Re: Simple structure and copying data to pointer of the same structure "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-04-14 18:15 +0200
            Re: Simple structure and copying data to pointer of the same structure Martijn van Buul <pino@dohd.org> - 2011-04-14 16:30 +0000
              Re: Simple structure and copying data to pointer of the same structure "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-04-14 18:39 +0200
                Re: Simple structure and copying data to pointer of the same structure Martijn van Buul <pino@dohd.org> - 2011-04-14 17:01 +0000
                Re: Simple structure and copying data to pointer of the same structure "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-04-14 19:12 +0200
                Re: Simple structure and copying data to pointer of the same structure gwowen <gwowen@gmail.com> - 2011-04-14 14:32 -0700
                Re: Simple structure and copying data to pointer of the same structure "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-04-14 23:48 +0200
                Re: Simple structure and copying data to pointer of the same structure gwowen <gwowen@gmail.com> - 2011-04-15 04:23 -0700
                Re: Simple structure and copying data to pointer of the same structure cg_chas <cg_chas@hotmail.com> - 2011-04-15 09:32 -0400
                Re: Simple structure and copying data to pointer of the same structure cg_chas <cg_chas@hotmail.com> - 2011-04-15 09:38 -0400
                Re: Simple structure and copying data to pointer of the same structure "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-04-15 18:48 +0200
                Re: Simple structure and copying data to pointer of the same structure cg_chas <cg_chas@hotmail.com> - 2011-04-15 13:21 -0400
                Re: Simple structure and copying data to pointer of the same structure "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-04-15 19:31 +0200
                Re: Simple structure and copying data to pointer of the same structure gwowen <gwowen@gmail.com> - 2011-04-15 11:45 -0700
                Re: Simple structure and copying data to pointer of the same structure Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-04-16 23:07 +0000
                Re: Simple structure and copying data to pointer of the same structure Martijn van Buul <pino@dohd.org> - 2011-04-15 20:08 +0000
                Re: Simple structure and copying data to pointer of the same structure "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-04-15 22:34 +0200
      Re: Simple structure and copying data to pointer of the same structure cg_chas <cg_chas@hotmail.com> - 2011-04-14 11:56 -0400
        Re: Simple structure and copying data to pointer of the same structure "A" <a@a.a> - 2011-04-14 18:02 +0200
          Re: Simple structure and copying data to pointer of the same structure cg_chas <cg_chas@hotmail.com> - 2011-04-14 12:15 -0400
      Re: Simple structure and copying data to pointer of the same structure "Thomas J. Gritzan" <phygon_antispam@gmx.de> - 2011-04-14 18:04 +0200
        Re: Simple structure and copying data to pointer of the same structure "A" <a@a.a> - 2011-04-14 18:15 +0200
          Re: Simple structure and copying data to pointer of the same structure "Thomas J. Gritzan" <phygon_antispam@gmx.de> - 2011-04-14 18:21 +0200
      Re: Simple structure and copying data to pointer of the same structure "Paul" <pchristor@yahoo.co.uk> - 2011-04-14 17:21 +0100
  Re: Simple structure and copying data to pointer of the same structure "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-04-14 18:10 +0200
  Re: Simple structure and copying data to pointer of the same structure Noah Roberts <dont@email.me> - 2011-04-14 09:31 -0700
    Re: Simple structure and copying data to pointer of the same structure "A" <a@a.a> - 2011-04-14 21:06 +0200
  Re: Simple structure and copying data to pointer of the same structure Goran <goran.pusic@gmail.com> - 2011-04-15 00:05 -0700

csiph-web