Re: VS2005 access violation on char array
- From: "Jack White" <no_spam@xxxxxxxxxxx>
- Date: Tue, 6 Mar 2007 12:13:38 -0500
I have an array defined as follows:
static CTS_PUCHAR auchKeys[] =
{
{(CTS_PUCHAR)"PCCCTEST ONTRACK"}, // 0
{(CTS_PUCHAR)"APPLN..1 ONTRACK"}, // 1
{(CTS_PUCHAR)"APPLN..2 ONTRACK"}, // 2
};
where:
typedef unsigned char CTS_UCHAR;
typedef CTS_UCHAR * CTS_PUCHAR;
In VC 6.0 I can do the following but in VS2005 it gives an access
violation
and I can't figure out why?
auchKeys[1][7] = '1';
It's illegal behaviour that you were getting away with in VC6. You can't
modify a string literal which is what you're doing here. A string literal is
an array of "const" char (or in your case "unsigned char").
.
- Follow-Ups:
- Re: VS2005 access violation on char array
- From: LarryW
- Re: VS2005 access violation on char array
- References:
- VS2005 access violation on char array
- From: LarryW
- VS2005 access violation on char array
- Prev by Date: Re: i can't get the correct result from the function.
- Next by Date: Re: VS2005 access violation on char array
- Previous by thread: VS2005 access violation on char array
- Next by thread: Re: VS2005 access violation on char array
- Index(es):
Relevant Pages
|