#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    79
    Rep Power
    12

    C ++ Linux system variables


    How does one request system varaibles fom linux? Like if I wanted to display the systems hostname or ip address or any other info about the system. Is there a list of the information that you can get from linux in C++.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    12
    Rep Power
    0
    getenv() or similar. It can return a NULL if it doesn't exist.

    Try:
    Code:
    const char *getSafeEnv(const char *pEnvName)
    {
      const char *pccValue = getenv(pEnvName);      
      return (pccValue ? pccValue : "(null)");
    }

IMN logo majestic logo spyfu logo threadwatch logo seochat tools logo