_wpopen

I am working with C++ and dll (d link lib). Its NOT EXE but DLL.
I have to read french characters that are generated when I execute a command line.
I was trying to use _wpopen but in vain.
Could you pls tell me:

1. What command in C++ would let me execute command line utilities so I can read them.
2. I am working with different languages so I am looking for something that is unicode based.

Thanks.
LVL 2
pb_indiaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rstaveleyCommented:
The only reason to use _wpopen is if your command is a wide character string. The returned FILE * is the same for _wpopen as it is for _popen, containing the standard output from your command.

Like a lot of experts at EE, I'm relatively weak at i18n, because I work in a locale in which 8-bit *external* representations are used. The idea of having > 8 bit standard output is weird to me... but presumably that's what you get in locals which require > 8 bit external representation for the required character set? wchar_t streams are externally represented as char streams in my locale. I don't get to see 16-bit characters on standard output from console programs, because characters are narrowed to 8 bits. If I were to write a program which outputs raw 16-bit UNICODE, I would need to open a file in binary mode. Presumably, I'd need to make the first bytes correspond to a BOM (= byte order marker). I'd certainly need to pass a binary flag to _open to get a byte stream from the command, if the UNICODE was being written to standard output, and then read wchar_ts from the byte stream.

Sorry I can't be more helpful.... but I am interested in whatever solution you find.
0
antoinebfCommented:
FYI, french does not require unicode support to be read/writen... ASCII is more than sufficient.

BTW, unicode is an encoding system used to represent almost any character. The encoding can span many bytes (multi byte representation). On the other hand, wide string (wopen, wstring, etc.) always use 2 bytes to represent chars (double byte representation).

All that to say that unicode and wide strings are not the same, and not fully compatible out of the box.

Have a look at:
http://www.unicode.org/

As for your questions:
1 - The win32 api call "int system(char*)" allows you to execute command line statements from within a C++ program.
2 - If windows is an option, their MFC's CString supports Unicode and might be of some help.

hth
A.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rstaveleyCommented:
I hadn't spotted the fact that pb_india was reading French characters. The name pb_india got me into Asian-think :-)

When I type chcp at a CMD prompt here in the UK, I see my codepage is 437 (which is described here: http://www.kostis.net/charsets/cp437.htm). I believe this is the same codepage as France and the US, from the DOS table at http://www.thur.de/~igs/USEFULL/OPENDOS/usrgeng/17ugch17.htm#390. If pb_india has the same codepage for his console applications, I'd agree with antoinebf and not expect the French characters captured by _popen to require translation.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.