From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,20d7dedd1509fe5e X-Google-Attributes: gid1164f8,public From: aaron@zk3.dec.com (Aaron Sawyer USG) Subject: Re: Printing Long Integers (Was:Running a process with different ID) Date: 1998/12/17 Message-ID: <75bmkc$ve9$1@lead.zk3.dec.com>#1/1 X-Deja-AN: 423352192 References: <75b86v$prh$1@nnrp1.dejanews.com> Followup-To: comp.sys.dec Organization: Compaq UNIX System Division Reply-To: aaron@zk3.dec.com Newsgroups: comp.sys.dec 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