C Function getenv() crashing in Windows10
I.T. updated one of my Engineers to Windows 10. He is our first one using Creo 3.0 m120 on the Windows 10 platform. One of my Toolkit Applications crashes on initialization. The apps work fine on the Win7 platform. I have Narrowed it down to the getenv() function. I checked on another program and sure enough the function where that is used crashes too. It does not crash on the call, but on the next line. I am compiling with VS 2012 (approved for Creo 3).
The getenv() is pretty critical to me as my apps run in different sites and different countries.
Has anyone else seen this, or can someone else verify this?
FILE *fp; /* test output */
char myvar[80];
char myvar2[16];
char *value;
SiteCode = 1;
fp = fopen ("c:\\temp\\subs.txt", "w");
/*================================================================*/
/* Set global variables for exports */
value = getenv("MFG_SITE");
strcpy(myvar2, value); /******************** Will crash here */
if (strstr(myvar2, "MTP") != NULL)
SiteCode = 1;
if (strstr(myvar2, "CRV") != NULL)
SiteCode = 2;
if (strstr(myvar2, "BGV") != NULL)
SiteCode = 3;
I also have crashes when trying to use the return value directly.
fprintf (fp, "Plat code is: %s \n" , getenv("MFG_SITE"));

