LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with strcpy?

I have problems with these lines of code (most lines are omitted, but I hope
to make my point in the next few lines).

in panelHandle, panelHandleREGEdit;
char LUT_defaultfilename[19];
int main (int argc, char *argv[])

{
if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external
compiler; harmless otherwise */
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "main.uir", PANEL_MAIN)) < 0)
return -1;
panelHandleREGEdit = LoadPanel (0, "main.uir", PANEL_REG);
printf("LoadPanel Status = %d\n",panelHandleREGEdit); // this prints the
value 12

// snip ...

printf("LoadPanel Status = %d\n",panelHandleREGEdit); // this prints the
value 12
strcpy(LUT_defaultfilename,
"");
printf("LoadPanel Status = %d\n",panelHandleREGEdit); // this prints the
value 0

// snip...

RunUserInterface ();
return 0;
}

So it seems that using the function strcpy changes the integer
panelHandleREGEdit. Has there any bug been reported concerning strcpy, or do
I overlook something?

Kind regards,
Geert Van Doorselaer
0 Kudos
Message 1 of 2
(3,020 Views)
The target string was badly defined, making strcpy writing characters in
memory space of other variables.
Sorry for bothering you.

Kind regards,
Geert Van Doorselaer
Message 2 of 2
(3,020 Views)