1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wxWidgets: Environment</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_container">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
<tbody>
<tr>
<td id="projectlogo">
<a href="http://www.wxwidgets.org/" target="_new">
<img alt="wxWidgets" src="logo.png"/>
</a>
</td>
<td style="padding-left: 0.5em; text-align: right;">
<span id="projectnumber">Version: 3.0.2</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.2 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Categories</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#typedef-members">Typedefs</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Environment</div> </div>
<div class="ingroups"><a class="el" href="group__group__funcmacro.html">Functions and Macros by Category</a></div></div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>These functions allow access to get or change the values of environment variables in a portable way. </p>
<p>They are currently implemented under Win32 and POSIX-like systems (Unix).</p>
<p>Remember that these functions add/change/delete environment variables of the current process only. Child processes copy the environment variables of the parent but do not share them (a <a class="el" href="group__group__funcmacro__env.html#gaaf7e73120ba323e10ea2d3724f1927b8" title="Sets the value of the environment variable var (adding it if necessary) to value.">wxSetEnv()</a> in the parent process won't change the value returned by <a class="el" href="group__group__funcmacro__env.html#ga077a7602cf1adee6ceea300731f245dc" title="Returns the current value of the environment variable var in value.">wxGetEnv()</a> in the child process and viceversa).</p>
<p>For more evoluted interprocess communication tecniques see <a class="el" href="overview_ipc.html">Interprocess Communication</a>. </p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga37c7bb54114fa4fdb99e19440ded6e00"><td class="memItemLeft" align="right" valign="top">typedef wxStringToStringHashMap </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__env.html#ga37c7bb54114fa4fdb99e19440ded6e00">wxEnvVariableHashMap</a></td></tr>
<tr class="memdesc:ga37c7bb54114fa4fdb99e19440ded6e00"><td class="mdescLeft"> </td><td class="mdescRight">A map type containing environment variables names and values. <a href="#ga37c7bb54114fa4fdb99e19440ded6e00"></a><br/></td></tr>
<tr class="separator:ga37c7bb54114fa4fdb99e19440ded6e00"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga2e874b3553a5a4f6a939aa83ab8dedfc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__funcmacro__string.html#gad42f64d8c82f1ce4ae58773a89b2d6a7">wxChar</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__env.html#ga2e874b3553a5a4f6a939aa83ab8dedfc">wxGetenv</a> (const <a class="el" href="classwx_string.html">wxString</a> &var)</td></tr>
<tr class="memdesc:ga2e874b3553a5a4f6a939aa83ab8dedfc"><td class="mdescLeft"> </td><td class="mdescRight">This is a macro defined as <code>getenv()</code> or its wide char version in Unicode mode. <a href="#ga2e874b3553a5a4f6a939aa83ab8dedfc"></a><br/></td></tr>
<tr class="separator:ga2e874b3553a5a4f6a939aa83ab8dedfc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga077a7602cf1adee6ceea300731f245dc"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__env.html#ga077a7602cf1adee6ceea300731f245dc">wxGetEnv</a> (const <a class="el" href="classwx_string.html">wxString</a> &var, <a class="el" href="classwx_string.html">wxString</a> *value)</td></tr>
<tr class="memdesc:ga077a7602cf1adee6ceea300731f245dc"><td class="mdescLeft"> </td><td class="mdescRight">Returns the current value of the environment variable <em>var</em> in <em>value</em>. <a href="#ga077a7602cf1adee6ceea300731f245dc"></a><br/></td></tr>
<tr class="separator:ga077a7602cf1adee6ceea300731f245dc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaaf7e73120ba323e10ea2d3724f1927b8"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__env.html#gaaf7e73120ba323e10ea2d3724f1927b8">wxSetEnv</a> (const <a class="el" href="classwx_string.html">wxString</a> &var, const <a class="el" href="classwx_string.html">wxString</a> &value)</td></tr>
<tr class="memdesc:gaaf7e73120ba323e10ea2d3724f1927b8"><td class="mdescLeft"> </td><td class="mdescRight">Sets the value of the environment variable <em>var</em> (adding it if necessary) to <em>value</em>. <a href="#gaaf7e73120ba323e10ea2d3724f1927b8"></a><br/></td></tr>
<tr class="separator:gaaf7e73120ba323e10ea2d3724f1927b8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga4a72b083dad08150adcf9f950677284c"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__env.html#ga4a72b083dad08150adcf9f950677284c">wxUnsetEnv</a> (const <a class="el" href="classwx_string.html">wxString</a> &var)</td></tr>
<tr class="memdesc:ga4a72b083dad08150adcf9f950677284c"><td class="mdescLeft"> </td><td class="mdescRight">Removes the variable <em>var</em> from the environment. <a href="#ga4a72b083dad08150adcf9f950677284c"></a><br/></td></tr>
<tr class="separator:ga4a72b083dad08150adcf9f950677284c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga147974e23a77dadf95a67317774ada4d"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__env.html#ga147974e23a77dadf95a67317774ada4d">wxGetEnvMap</a> (<a class="el" href="group__group__funcmacro__env.html#ga37c7bb54114fa4fdb99e19440ded6e00">wxEnvVariableHashMap</a> *map)</td></tr>
<tr class="memdesc:ga147974e23a77dadf95a67317774ada4d"><td class="mdescLeft"> </td><td class="mdescRight">Fill a map with the complete content of current environment. <a href="#ga147974e23a77dadf95a67317774ada4d"></a><br/></td></tr>
<tr class="separator:ga147974e23a77dadf95a67317774ada4d"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="ga37c7bb54114fa4fdb99e19440ded6e00"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef wxStringToStringHashMap <a class="el" href="group__group__funcmacro__env.html#ga37c7bb54114fa4fdb99e19440ded6e00">wxEnvVariableHashMap</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>A map type containing environment variables names and values. </p>
<p>This type is used with <a class="el" href="group__group__funcmacro__env.html#ga147974e23a77dadf95a67317774ada4d" title="Fill a map with the complete content of current environment.">wxGetEnvMap()</a> function and <a class="el" href="structwx_execute_env.html" title="This structure can optionally be passed to wxExecute() to specify additional options to use for the c...">wxExecuteEnv</a> structure optionally passed to <a class="el" href="group__group__funcmacro__procctrl.html#gaa276e9e676e26bafeec3141b73399b33" title="Executes another program in Unix or Windows.">wxExecute()</a>.</p>
<dl class="section since"><dt>Since</dt><dd>2.9.2</dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/utils.h> </pre>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga2e874b3553a5a4f6a939aa83ab8dedfc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__group__funcmacro__string.html#gad42f64d8c82f1ce4ae58773a89b2d6a7">wxChar</a>* wxGetenv </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>var</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This is a macro defined as <code>getenv()</code> or its wide char version in Unicode mode. </p>
<p>Note that under Win32 it may not return correct value for the variables set with <a class="el" href="group__group__funcmacro__env.html#gaaf7e73120ba323e10ea2d3724f1927b8" title="Sets the value of the environment variable var (adding it if necessary) to value.">wxSetEnv()</a>, use <a class="el" href="group__group__funcmacro__env.html#ga077a7602cf1adee6ceea300731f245dc" title="Returns the current value of the environment variable var in value.">wxGetEnv()</a> function instead.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/utils.h> </pre>
</div>
</div>
<a class="anchor" id="ga077a7602cf1adee6ceea300731f245dc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxGetEnv </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>var</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classwx_string.html">wxString</a> * </td>
<td class="paramname"><em>value</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the current value of the environment variable <em>var</em> in <em>value</em>. </p>
<p><em>value</em> may be <span class="literal">NULL</span> if you just want to know if the variable exists and are not interested in its value.</p>
<p>Returns <span class="literal">true</span> if the variable exists, <span class="literal">false</span> otherwise.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/utils.h> </pre>
</div>
</div>
<a class="anchor" id="ga147974e23a77dadf95a67317774ada4d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxGetEnvMap </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__group__funcmacro__env.html#ga37c7bb54114fa4fdb99e19440ded6e00">wxEnvVariableHashMap</a> * </td>
<td class="paramname"><em>map</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Fill a map with the complete content of current environment. </p>
<p>The map will contain the environment variable names as keys and their values as values.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">map</td><td>The environment map to fill, must be non-<span class="literal">NULL</span>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><span class="literal">true</span> if environment was successfully retrieved or <span class="literal">false</span> otherwise.</dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/utils.h> </pre><dl class="section since"><dt>Since</dt><dd>2.9.2 </dd></dl>
</div>
</div>
<a class="anchor" id="gaaf7e73120ba323e10ea2d3724f1927b8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxSetEnv </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>var</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>value</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the value of the environment variable <em>var</em> (adding it if necessary) to <em>value</em>. </p>
<p>Notice that under Windows platforms the program may have two different environment blocks: the first one is that of a Windows process and is always present, but the CRT may maintain its own independent copy of the environment. <a class="el" href="group__group__funcmacro__env.html#gaaf7e73120ba323e10ea2d3724f1927b8" title="Sets the value of the environment variable var (adding it if necessary) to value.">wxSetEnv()</a> will always update the first copy, which means that <a class="el" href="group__group__funcmacro__env.html#ga077a7602cf1adee6ceea300731f245dc" title="Returns the current value of the environment variable var in value.">wxGetEnv()</a>, which uses it directly, will always return the expected value after this call. But <a class="el" href="group__group__funcmacro__env.html#gaaf7e73120ba323e10ea2d3724f1927b8" title="Sets the value of the environment variable var (adding it if necessary) to value.">wxSetEnv()</a> only updates the second copy for some compilers/CRT implementations (currently only MSVC and MinGW which uses the same MSVC CRT) and so using <a class="el" href="group__group__funcmacro__env.html#ga2e874b3553a5a4f6a939aa83ab8dedfc" title="This is a macro defined as getenv() or its wide char version in Unicode mode.">wxGetenv()</a> (notice the difference in case) may not return the updated value.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">var</td><td>The environment variable to be set, must not contain <code>'='</code> character. </td></tr>
<tr><td class="paramname">value</td><td>New value of the variable. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><span class="literal">true</span> on success or <span class="literal">false</span> if changing the value failed.</dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__env.html#ga4a72b083dad08150adcf9f950677284c" title="Removes the variable var from the environment.">wxUnsetEnv()</a></dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/utils.h> </pre>
</div>
</div>
<a class="anchor" id="ga4a72b083dad08150adcf9f950677284c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxUnsetEnv </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>var</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Removes the variable <em>var</em> from the environment. </p>
<p><a class="el" href="group__group__funcmacro__env.html#ga077a7602cf1adee6ceea300731f245dc" title="Returns the current value of the environment variable var in value.">wxGetEnv()</a> will return <span class="literal">NULL</span> after the call to this function.</p>
<p>Returns <span class="literal">true</span> on success.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/utils.h> </pre>
</div>
</div>
</div><!-- contents -->
<address class="footer">
<small>
Generated on Thu Nov 27 2014 13:46:43 for wxWidgets by <a href="http://www.doxygen.org/index.html" target="_new">Doxygen</a> 1.8.2
</small>
</address>
<script src="wxwidgets.js" type="text/javascript"></script>
</div><!-- #page_container -->
</body>
</html>
|