View Single Post
Old Nov 8th, 2006, 1:34 AM   #4
Ghosty
Newbie
 
Join Date: May 2005
Location: NJ
Posts: 18
Rep Power: 0 Ghosty is on a distinguished road
Send a message via AIM to Ghosty
Fixed. Thanks for the reply DaWei. That code is rubbish anyway. My completed assignment is 4 lines of code. I didn't need malloc/free or new/delete as my book was misleading. I do need to get a refresher on pointers though.

//This code works
#include <iostream>
#include <cstdlib>

using namespace std;

int main(){

  char name []={"PS1=<duck>"};
  putenv(name);
  char * envVar = getenv ("PS1");
  cout << "PS1 value is currently: " << envVar << endl;

  return 0;
}
Ghosty is offline   Reply With Quote