hi all,
i have the following scenario:
the environment
variables will be set using shell encoding
also the filepaths( that could be
passed as command line arg.)
& in my program, i am using _wgetenv()
to get env. var.
& GetCommandLineW() to get command line
the
shell used by the user could be anything , my program has to take
care of
that
one problem could be as follows:
When a character in one
code page is unavailable on another and
conversion occurs, the character is
converted to its closest equivalent
character in the other code page. For
example, ASCII 156 (Å) in code
page 1252 is converted to ASCII 111 (o) in
code page 437 because this is
the most similar character in the code page
437. When you convert this
ANSI character back to code page 1252, the result
is ASCII 111 (o),
because ASCII 111 (o) exists in both code pages. The
original 1252
character (Å) is lost.
so i am able to retain its hex value,
i will be always on the safer side
a portion of my prog.
int
main()
{
//here i am trying to do some manipulation with
SetConsoleCP(),GetConsoleCP()
int argc1;
wchar_t **argv1 =
0;
argv1 = CommandLineToArgvW(GetCommandLineW(),
&argc1);
cout << "no. of arg.'s " <<
argc1;
for ( int j=0; j < argc1; j++
)
wcout << L"\n" <<
argv1[j];
// here i might open some file
if( 0 !=
_wgetenv(L"AM_HOME"))
wcout <<
_wgetenv(L"AM_HOME");
else
wcout
<< L"could not read environment variable";
//here i might have to
open the file again
}
what additions do i need to
do?
thanks
deepak

