Skip to main content
gamedev.net
๐Ÿ”’ Locked

SetEnvironmentVariable

Started by encom Mar 23, 2004 at 8:52 AM 0 replies 500+ views
Original Post
encom
encom
Hi On windows (nt/xp/2k, how to add a directory to PATH env variable ? When i use : char *env = toString("%s:%s", GetEnvironmentStrings("PATH") + "myPath"); SetEnvironmentVariable("PATH", env); Before setEnv, i can use system(..) funtion to call "CMD", after setEnv i can not ! Why ?
Oluseyi
Oluseyi
Because you fucked up the path. GetEnvironmentString returns a void pointer to an environment block, not a string. Read

Furthermore, you can''t add two C-style strings together using the + operator. Use sprintf.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.