I have to make a DOS (real DOS, not a Win32 command line app) program that parse a file a set some environment variables.
I made the full program when I stuck against the apparently easy task of setting the environment variables.
I know it exists a int putenv(const char*); function that should do the job. But it actually does not work.
Here a little example:
Code:
#include <iostream>
int main()
<%using namespace std;
int stat = putenv("HELLO=C:\\TEMP");
if (stat == -1)
<%
cout<<"failed to define environment variable"<<endl;
%>
%>
Try to compile this code and execute it, it won't set anything even if stat == 0 as success!
I also tried uselessy system("set HELLO=TEST");, do anyone have an idea?
Thanks.