Re: Problem with VS and memcpy...
- From: "Paolo" <paomic@xxxxxxxxx>
- Date: 29 Jun 2006 03:12:58 -0700
Why 0 is the same as \0?
So I can't enter 0 in an array of char?
John Carson ha scritto:
"Paolo" <paomic@xxxxxxxxx> wrote in message
news:1151575114.297220.27410@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
The excat code is:
int number = 25;
int offSet = 16000;
unsigned char header[8];
header[0] = 0;
Just as I thought. Entering 0 as a character is the same as entering '\0'.
Thus header has a terminating nul character as its first character.
Accordingly, "" is the correct representation.
header[1] = 255;
header[2] = 0;
header[3] = number>>8;
header[4] = number;
header[5] = offSet>>16;
header[6] = offSet>>8;
header[7] = offSet;
memcpy(buffer, header, sizeof header);
--
John Carson
.
- Follow-Ups:
- Re: Problem with VS and memcpy...
- From: John Carson
- 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
- Re: Problem with VS and memcpy...
- From: John Carson
- Re: Problem with VS and memcpy...
- From: Paolo
- Re: Problem with VS and memcpy...
- From: John Carson
- Problem with VS and memcpy...
- Prev by Date: sprintf' : undeclared identifier..
- Next by Date: Re: sprintf' : undeclared identifier..
- Previous by thread: Re: Problem with VS and memcpy...
- Next by thread: Re: Problem with VS and memcpy...
- Index(es):
Relevant Pages
|