Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* printf-problem
@ 1996-01-17  5:00 Henrik Wist
  1996-01-17  5:00 ` printf-problem P.Bennett
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Henrik Wist @ 1996-01-17  5:00 UTC (permalink / raw)


Hi Folks!
Got a little problem with printing large int's from a c-program.
Platform: Digital Alpha running DG-UX3.2

Problem:
.
.
.

long int zahl;   /* which is e.g. 10000500001 */
printf("%d\n",zahl);      /* gives 1410565409, which is definitly wrong */
.
.
.

Is that a problem of printf() or DG-UX or is it my problem that I don't know
the right conversion for printf(). Btw, printf("%u",zahl) didn't work either.
Any suggestions?
Thanks alot,
Henrik
---------------------------------------------------------------------
"Woher soll ich wissen, was ich denke, bevor    |Tel.:+49/89/3089598
ich nicht gehoert habe, was ich sage?"          |smail: Destouchesstr.71
IRC: |GOOSE|                                    |       80796 Munich
Systemadministrator am Lehrstuhl A fuer Mechanik|       Germany
---------------------------------------------------------------------
>>>http://www.lam.mw.tu-muenchen.de/mitarb/wist.html<<<




^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: printf-problem
@ 1996-01-17  5:00 The Amorphous Mass
  0 siblings, 0 replies; 10+ messages in thread
From: The Amorphous Mass @ 1996-01-17  5:00 UTC (permalink / raw)


On 17 Jan 1996, Henrik Wist wrote:

> Hi Folks!
> Got a little problem with printing large int's from a c-program.
> Platform: Digital Alpha running DG-UX3.2
> 
> long int zahl;   /* which is e.g. 10000500001 */
> printf("%d\n",zahl);      /* gives 1410565409, which is definitly wrong */

  Try

printf("%ld\n", zahl);

  It tells printf() that you want zahl printed as a long int (ref. K&R 
II, page 244).

/**James Robinson***********************            
  "If a fatal error occurs, the program should not be allowed to continue."
 -- Oracle Pro*C User's Guide         *************james-robinson@uiowa.edu**/





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

end of thread, other threads:[~1996-01-22  5:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-01-17  5:00 printf-problem Henrik Wist
1996-01-17  5:00 ` printf-problem P.Bennett
1996-01-17  5:00   ` printf-problem The Amorphous Mass
1996-01-17  5:00 ` printf-problem Alun Champion
1996-01-17  5:00 ` printf-problem Lawrence Kirby
1996-01-18  5:00   ` printf-problem Dik T. Winter
1996-01-18  5:00 ` printf-problem Henrik Wist
1996-01-19  5:00 ` printf-problem Achim Reeh
1996-01-22  5:00   ` printf-problem Norman Gaywood
  -- strict thread matches above, loose matches on Subject: below --
1996-01-17  5:00 printf-problem The Amorphous Mass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox