* Printing Long Integers (Was:Running a process with different ID)
@ 1998-12-17 5:00 wcoltters
1998-12-17 5:00 ` Aaron Sawyer USG
0 siblings, 1 reply; 2+ messages in thread
From: wcoltters @ 1998-12-17 5:00 UTC (permalink / raw)
Hi,
me again.
Thank you for your answers! :-)
I have another problem now. :(
I want to send to the standar output
the value of a long variable, but
it seems printf refuse to do it.
I looked for in the manuals but...
void main (void)
{
long dummy;
.
.
.
.
printf("Dummy is %??? :", dummy);
}
Thanks in advance.
Wilson.
wcoltters@yahoo.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Printing Long Integers (Was:Running a process with different ID)
1998-12-17 5:00 Printing Long Integers (Was:Running a process with different ID) wcoltters
@ 1998-12-17 5:00 ` Aaron Sawyer USG
0 siblings, 0 replies; 2+ messages in thread
From: Aaron Sawyer USG @ 1998-12-17 5:00 UTC (permalink / raw)
You'll find this in the C language standard ISO/IEC 9899:1990(E) section
7.9.6. Formatted input/output functions
Here's the example, expanded a bit:
% cat foo.c
void main (void)
{
long dummy = 18446471394825863167; /* from bc: 2^64-2^48+2^43-1 */
/* FFFF07FFFFFFFFFF from bc: obase=16 ; 2^64-2^48+2^43-1 */
printf("Dummy is %#0 24ld ( signed dec via '%%#0 24ld')\n", dummy);
printf("Dummy is %#0 24li ( signed dec via '%%#0 24li')\n", dummy);
printf("Dummy is %#0 24lu (unsigned dec via '%%#0 24lu')\n", (unsigned long)dummy);
printf("Dummy is %#0 24lo (unsigned oct via '%%#0 24lo')\n", (unsigned long)dummy);
printf("Dummy is %#0 24lx (unsigned hex via '%%#0 24lx')\n", (unsigned long)dummy);
}
% cc -O -o foo{,.c}
% ./foo
Dummy is -00000000272678883688449 ( signed dec via '%#0 24ld')
Dummy is -00000000272678883688449 ( signed dec via '%#0 24li')
Dummy is 000018446471394825863167 (unsigned dec via '%#0 24lu')
Dummy is 001777770177777777777777 (unsigned oct via '%#0 24lo')
Dummy is 0x000000ffff07ffffffffff (unsigned hex via '%#0 24lx')
Hope this helps you.
=Aaron
.==================================v===================================.
: "The view from here? Strictly deja." -- RetroDude :
: D. Aaron Sawyer ZKO03-03/V08 : My opinion(s) only; not Compaq's :
: UNIX Software Division : Voice: +1.603.884.2918 :
: Compaq Computer Corporation : (Just the) Fax: +1.603.884.2257 :
: 110 Spitbrook Road : Internet: aaron@zk3.dec.com :
: Nashua, NH 03062-2642 : DECnet: alpha::aaron :
: "The entity formerly known as Digital Equipment Corporation (DEC)" :
`==================================^==================================='
In article <75b86v$prh$1@nnrp1.dejanews.com>, wcoltters@yahoo.com writes:
|> Hi,
|> me again.
|> Thank you for your answers! :-)
|>
|> I have another problem now. :(
|> I want to send to the standar output
|> the value of a long variable, but
|> it seems printf refuse to do it.
|> I looked for in the manuals but...
|>
|> void main (void)
|> {
|> long dummy;
|> .
|> .
|> printf("Dummy is %??? :", dummy);
|>
|> }
|>
|> Thanks in advance.
|>
|> Wilson.
|> wcoltters@yahoo.com
|>
|> -----------== Posted via Deja News, The Discussion Network ==----------
|> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-12-17 5:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-12-17 5:00 Printing Long Integers (Was:Running a process with different ID) wcoltters
1998-12-17 5:00 ` Aaron Sawyer USG
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox