Victor Bazarov <v.********@comacast.netwrote:
Lionel B wrote:
>On Thu, 01 Mar 2007 04:44:12 -0800, HardHackz wrote:
>>Are there any variables like %HOMEDIR%, %USERNAME%, etc. that batch
has for C++?
No. That's all system-dependent. C++ doesn't assume that things like
"user" or "directory" even exist (although it does have a notion of
"file"). Think about it: a microchip controlling your fridge might be
programmed in C++...
Not sure what is meant by 'variables like batch has', but if those
are "environment" variables, see 'getenv' function.
Also, your implementation may provide a signature for main() like:
int main(int argc, char* argv[], char* envp[])
where envp is an array of C-style strings representing the current
environment.
See if this works on your implementation:
#include <iostream>
int main(int argc, char* argv[], char* envp[])
{
using std::cout;
for (int i = 0; envp[i] != 0; ++i) {
cout << envp[i] << '\n';
}
return 0;
}
--
Marcus Kwok
Replace 'invalid' with 'net' to reply