delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/12/07/18:14:37

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3FD3C2A0.4050208@terra.com.br>
Date: Sun, 07 Dec 2003 21:15:28 -0300
From: =?ISO-8859-1?Q?Marcelo_Rezende_M=F3dolo?= <mrmodolo AT terra DOT com DOT br>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007
X-Accept-Language: pt-br, en-us, en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: LOCALE ERROR
References: <3FD3502C DOT 2020600 AT terra DOT com DOT br> <Pine DOT GSO DOT 4 DOT 56 DOT 0312071506150 DOT 16580 AT slinky DOT cs DOT nyu DOT edu>
In-Reply-To: <Pine.GSO.4.56.0312071506150.16580@slinky.cs.nyu.edu>

I read the man pages "man setlocale", "man strftime" and find a mistake 
in str format.
I use ' if (!strftime((char *)str, 100, "%#x", (const struct tm 
*)thetime))' but the correct is
' if (!strftime((char *)str, 100, "%x", (const struct tm *)thetime))'...
But I still have the same output for all setlocale I use.
setlocale(LC_ALL, "C");
setlocale(LC_ALL, "pt_BR");
setlocale(LC_ALL, "ja");
...
$ ./crt_locale.exe
'Mon Dec 08 2003'
'Mon Dec 08 2003'
'Mon Dec 08 2003'
'Mon Dec 08 2003'

thanks,
Marcelo Modolo


Igor Pechtchanski wrote:

> On Sun, 7 Dec 2003, Marcelo Rezende Módolo wrote:
>
>> Hi,
>> I have a program that needs the locale support, so I include 'locale.h'.
>> I make the program but the output was wrong.
>> With the cygwin library the setlocale function do not work, but if I
>> link with mingw library it is ok I am sending a sample program that
>> demonstrate the error.
>>
>> Linking with CYGWIN:
>>     marcelo AT est01 /usr/src/testes/locale/msdn
>>     $ gcc -o crt_locale crt_locale.c
>>     marcelo AT est01 /usr/src/testes/locale/msdn
>>     $
>>     $ ./crt_locale.exe
>>     In German locale, strftime returns 'x'
>>     No Brasil locale, strftime retorna 'x'
>>     In 'C' locale, strftime returns 'x'
>>     marcelo AT est01 /usr/src/testes/locale/msdn
>>     $
>>
>> Linking with MINGW (-mno-cygwin)
>>     marcelo AT est01 /usr/src/testes/locale/msdn
>>     $ gcc -mno-cygwin -o crt_locale crt_locale.c
>>     marcelo AT est01 /usr/src/testes/locale/msdn
>>     $
>>     $ ./crt_locale.exe
>>     In German locale, strftime returns 'Sonntag, 07. Dezember 2003'
>>     No Brasil locale, strftime retorna 'domingo, 07 de dezembro de 2003'
>>     In 'C' locale, strftime returns 'Sunday, December 07, 2003'
>>     marcelo AT est01 /usr/src/testes/locale/msdn
>>     $
>>
>> Thanks,
>> Marcelo Modolo
>
>
> "man setlocale", "man strftime".
>     Igor





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019