Connecting Tech Pros Worldwide Forums | Help | Site Map

int main(int argc, wchar_t* argv[]) using gcc 3.4.2 .

Vinu
Guest
 
Posts: n/a
#1: Jul 23 '05
hi
How can i accept unicode char in command line. The application on
Solaris Sparc expects wide characters for its processing

Can you suggest standard way of doing it on Sun Solaris Sparc? We are
using gcc 3.4.2 .

Thanks
Vinu


Ioannis Vranos
Guest
 
Posts: n/a
#2: Jul 23 '05

re: int main(int argc, wchar_t* argv[]) using gcc 3.4.2 .


Vinu wrote:
[color=blue]
> hi
> How can i accept unicode char in command line. The application on
> Solaris Sparc expects wide characters for its processing
>
> Can you suggest standard way of doing it on Sun Solaris Sparc? We are
> using gcc 3.4.2 .[/color]


Use wchar_t (built in type), wcin and wcout (<iostream>) inside the application.


Now there is no standard way for receiving wchar_t from the command line. You will have to
use a system extension for that.

A standard work-around way could be to enter the arguments not from the command line but
from inside the application by using wcin. For example instead of the user entering

../whatever -p he would do:


the program will prompt for them:

../whatever

Please insert parameters:


Just a thought anyway.


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Vinu
Guest
 
Posts: n/a
#3: Jul 23 '05

re: int main(int argc, wchar_t* argv[]) using gcc 3.4.2 .



i want a main like this
int wmain(int argc, wchar_t* argv[])

Vinu
Guest
 
Posts: n/a
#4: Jul 23 '05

re: int main(int argc, wchar_t* argv[]) using gcc 3.4.2 .




hi
How can i accept unicode char in command line. The application on
Solaris Sparc expects wide characters for its processing


Can you suggest standard way of doing it on Sun Solaris Sparc? We are
using gcc 3.4.2 .


Thanks
Vinu

Ron Natalie
Guest
 
Posts: n/a
#5: Jul 23 '05

re: int main(int argc, wchar_t* argv[]) using gcc 3.4.2 .


Vinu wrote:[color=blue]
>
> hi
> How can i accept unicode char in command line. The application on
> Solaris Sparc expects wide characters for its processing
>
>
> Can you suggest standard way of doing it on Sun Solaris Sparc? We are
> using gcc 3.4.2 .
>
>[/color]
I suspect it's less a GCC issue than a Solaris OS issue. Most of
the Sun OS's I've used that could handle Unicode at all have UTF-8
(that is, multibyte 8-bit) representations for Unicdoe on all the
system interfaces (program arguments, file names, ...). This is
fine because C++ is defective in defining wchar_t interfaces for
everything that needs them anyhow.

Use the " main(int, char**)" main signature and convert from
multibyte to wchar_t in main.
Closed Thread