-
June 23rd, 2009, 12:19 PM
#1
[RESOLVED] Access Violation problem
I'm trying to transform the LPSTR to contain the length at the start
the access violation is here:
func[nFuncs][i][0] = test;
I'm creating an xLL and don't know why i'm receiving the access violation
at the top I have
Code:
int numFuncs =4;
static LPSTR func[][9] = {
{" descDataStore", " I", " descDataStore", " ", " 1", " MyCat", " ", " ", " "},
{" grpIFSEntity", " I", " grpIFSEntity", " ", " 1", " MyCat", " ", " ", " "},
{" enterIFSEntity", " I", " enterIFSEntity", " ", " 1", " MyCat", " ", " ", " "},
{" retData", " I", " retData", " ", " 1", " MyCat", " ", " ", " "},
{0,0,0,0, 0, 0, 0}
};
In the same cpp file (when called)
Code:
BOOL __stdcall xlAutoOpen(void) {
int i;
int j;
int nFuncs;
BYTE test;
// Prefix strengths with their length & count items
// Note the framework's TempStr() function prefixes the
// lengths anyway, but this is for other code that might
// use the arrays
for(nFuncs=0;nFuncs<numFuncs; nFuncs++) {
for(i=0; i<9; i++) {
test = (BYTE) strlen(func[nFuncs][i]+1);
func[nFuncs][i][0] = test;
}
}
}
-
June 23rd, 2009, 01:21 PM
#2
Re: Access Violation problem
Fix it by defining a new LPSTR(a temporary) moving the length to the temp and then making the item in array = to temp
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|