Re: Problem with VS and memcpy...
- From: "John Carson" <jcarson_n_o_sp_am_@xxxxxxxxxxxxxxx>
- Date: Thu, 29 Jun 2006 19:48:21 +1000
"Paolo" <paomic@xxxxxxxxx> wrote in message
news:1151573245.812709.93530@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Yes I amde some mistakes in the code, I couldn't paste because it was
too long.
Yes, the correct lines are
unsigned char* buffer = new unsigned char[1000];
and
memcpy(buf, temp, sizeof temp);
I didn't use the redundant casts at first, but then I added them, but
nothing changed.
The problem isI just can't see why if I use the debugger before the
memcpy I can see something like
buffer = 0x01234456 "yqhsfjkvdfdsfhfe"
Where "yqhsfjkvdfdsfhfe" ius the content of the buffer, but after
thememcpy it becomes
buffer = 0x01234456 ""
Is it normal?
The content of buffer will only be displayed up until the first terminating
zero. It looks to me like temp has a terminating zero (i.e., '\0') as its
first character.
You need to give us code that actually exhibits the problem (and no other
problem). Code that looks like your code but doesn't have the problem is
useless.
--
John Carson
.
- Follow-Ups:
- Re: Problem with VS and memcpy...
- From: Paolo
- Re: Problem with VS and memcpy...
- References:
- Problem with VS and memcpy...
- From: Paolo
- Re: Problem with VS and memcpy...
- From: Tom Widmer [VC++ MVP]
- Re: Problem with VS and memcpy...
- From: Paolo
- Problem with VS and memcpy...
- Prev by Date: Re: Problem with VS and memcpy...
- Next by Date: Re: Problem with VS and memcpy...
- Previous by thread: Re: Problem with VS and memcpy...
- Next by thread: Re: Problem with VS and memcpy...
- Index(es):
Relevant Pages
|