Skip to content

Instantly share code, notes, and snippets.

@wavescholar
Created April 13, 2014 01:51
Show Gist options
  • Select an option

  • Save wavescholar/10565397 to your computer and use it in GitHub Desktop.

Select an option

Save wavescholar/10565397 to your computer and use it in GitHub Desktop.
Modify Path in C++
//Try to set the path to the Matlab binaries. The below does not work. The runtime
//tries to load the dependencies before this can be executed. Investigate delay loadding of dll.
//The code is kept here for reference.
//I have previously experienced an issue where the environment variable can not be used. There is a maximun path
//length of 2048 for the system environment variable. Exceeding this will cause
//myriad problems with a Windows 7 system. If you find you icon image cache is corrupt - check the
//length of your path variable.
//char* envV= getenv("PATH");
////Returns an errno if there is a problem.
////int setOK = _putenv( "PATH=C:\\Program Files\\MATLAB\\R2012b\\bin\\win64;%PATH%");
//system("set PATH=C:\\Program Files\\MATLAB\\R2012b\\bin\\win64;%PATH%"); //This works too
//envV= getenv("PATH");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment