public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Scanf with a long long.
@ 2001-09-05 15:54 Kurt Roeckx
  2001-09-06  0:23 ` Corinna Vinschen
  0 siblings, 1 reply; 5+ messages in thread
From: Kurt Roeckx @ 2001-09-05 15:54 UTC (permalink / raw)
  To: cygwin

I need use a 64 bit number, and int64_t is defined as a long
long.

The problem is that scanf doesn't like numbers bigger then
0xFFFFFFFF, and always returns that number in that case.  printf
works fine with them.

An example is doing this:

	long long int	i;

	sscanf("123456789", "%Lx", &i);
	printf("%llx\n%llx\n", i, i + 1);

it will print:

ffffffff
100000000

This problem seems to be reported once before in 1997, but still
doesn't seem to be fixed.
I'm using cygwin 1.3.2 on win98.


Kurt


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Scanf with a long long.
  2001-09-05 15:54 Scanf with a long long Kurt Roeckx
@ 2001-09-06  0:23 ` Corinna Vinschen
  2001-09-06  8:32   ` Kurt Roeckx
  0 siblings, 1 reply; 5+ messages in thread
From: Corinna Vinschen @ 2001-09-06  0:23 UTC (permalink / raw)
  To: cygwin

On Thu, Sep 06, 2001 at 12:54:13AM +0200, Kurt Roeckx wrote:
> I need use a 64 bit number, and int64_t is defined as a long
> long.
> 
> The problem is that scanf doesn't like numbers bigger then
> 0xFFFFFFFF, and always returns that number in that case.  printf
> works fine with them.
> 
> An example is doing this:
> 
> 	long long int	i;
> 
> 	sscanf("123456789", "%Lx", &i);
> 	printf("%llx\n%llx\n", i, i + 1);
> 
> it will print:
> 
> ffffffff
> 100000000
> 
> This problem seems to be reported once before in 1997, but still
> doesn't seem to be fixed.
> I'm using cygwin 1.3.2 on win98.

It's a newlib problem. Nobody implemented strtoll or strtoull
so far.  So scanf can't call them.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Scanf with a long long.
  2001-09-06  0:23 ` Corinna Vinschen
@ 2001-09-06  8:32   ` Kurt Roeckx
  2001-09-06  8:38     ` Larry Hall (RFK Partners, Inc)
  0 siblings, 1 reply; 5+ messages in thread
From: Kurt Roeckx @ 2001-09-06  8:32 UTC (permalink / raw)
  To: cygwin

On Thu, Sep 06, 2001 at 09:23:21AM +0200, Corinna Vinschen wrote:
> 
> It's a newlib problem. Nobody implemented strtoll or strtoull
> so far.  So scanf can't call them.

So, what didn't you take the one from glibc, or the one written
by DJ Delorie?  Newlib seems to include other things from him
too.

Anyway, I took the time to write my own version, if anybody is
intrested.


Kurt


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Scanf with a long long.
  2001-09-06  8:32   ` Kurt Roeckx
@ 2001-09-06  8:38     ` Larry Hall (RFK Partners, Inc)
  2001-09-06  8:48       ` Corinna Vinschen
  0 siblings, 1 reply; 5+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2001-09-06  8:38 UTC (permalink / raw)
  To: Kurt Roeckx, cygwin

At 11:32 AM 9/6/2001, Kurt Roeckx wrote:
>On Thu, Sep 06, 2001 at 09:23:21AM +0200, Corinna Vinschen wrote:
> > 
> > It's a newlib problem. Nobody implemented strtoll or strtoull
> > so far.  So scanf can't call them.
>
>So, what didn't you take the one from glibc, or the one written
>by DJ Delorie?  Newlib seems to include other things from him
>too.


Patches are generally accepted from anyone who cares to make them.


>Anyway, I took the time to write my own version, if anybody is
>intrested.


The newlib folks may be.  Why not send it on to them?





Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
118 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Scanf with a long long.
  2001-09-06  8:38     ` Larry Hall (RFK Partners, Inc)
@ 2001-09-06  8:48       ` Corinna Vinschen
  0 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2001-09-06  8:48 UTC (permalink / raw)
  To: cygwin

On Thu, Sep 06, 2001 at 11:39:23AM -0400, Larry Hall (RFK Partners, Inc) wrote:
> At 11:32 AM 9/6/2001, Kurt Roeckx wrote:
> >On Thu, Sep 06, 2001 at 09:23:21AM +0200, Corinna Vinschen wrote:
> > > 
> > > It's a newlib problem. Nobody implemented strtoll or strtoull
> > > so far.  So scanf can't call them.
> >
> >So, what didn't you take the one from glibc, or the one written

Newlib can't take from glibc due to licensing constraints.

> >by DJ Delorie?  Newlib seems to include other things from him
> >too.
> 
> 
> Patches are generally accepted from anyone who cares to make them.

That's right and it's sometimes really easy:  Nobody cared to
send a patch to the newlib folks so far and the newlib folks
are doing other stuff.

> >Anyway, I took the time to write my own version, if anybody is
> >intrested.
> 
> 
> The newlib folks may be.  Why not send it on to them?

I agree.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-09-06  8:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-05 15:54 Scanf with a long long Kurt Roeckx
2001-09-06  0:23 ` Corinna Vinschen
2001-09-06  8:32   ` Kurt Roeckx
2001-09-06  8:38     ` Larry Hall (RFK Partners, Inc)
2001-09-06  8:48       ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).