linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* printf *%f
@ 2011-01-12  7:39 ratheesh k
  2011-01-12  7:46 ` Bert Wesarg
  0 siblings, 1 reply; 7+ messages in thread
From: ratheesh k @ 2011-01-12  7:39 UTC (permalink / raw)
  To: linux-c-programming

double x=45.9876 ;

printf("%4.2f" , x); is working fine ...  But printf("%*f , 4.2 , x) ;
behaves odd in my  fedora 8 pentium machine. any clue ?

Does *  substitute only integers ?


-Ratheesh

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

* Re: printf *%f
  2011-01-12  7:39 printf *%f ratheesh k
@ 2011-01-12  7:46 ` Bert Wesarg
       [not found]   ` <AANLkTi=f-TrLVC-S9PpY-HcLKgujNOtii7bG-U5tSPyy@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Bert Wesarg @ 2011-01-12  7:46 UTC (permalink / raw)
  To: ratheesh k; +Cc: linux-c-programming

On Wed, Jan 12, 2011 at 08:39, ratheesh k <ratheesh.ksz@gmail.com> wrote:
> double x=45.9876 ;
>
> printf("%4.2f" , x); is working fine ...  But printf("%*f , 4.2 , x) ;

printf("%*.*f" , 4, 2 , x) ;

Bert

> behaves odd in my  fedora 8 pentium machine. any clue ?
>
> Does *  substitute only integers ?
>
>
> -Ratheesh
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: printf *%f
       [not found]   ` <AANLkTi=f-TrLVC-S9PpY-HcLKgujNOtii7bG-U5tSPyy@mail.gmail.com>
@ 2011-01-12  8:51     ` Bert Wesarg
       [not found]       ` <AANLkTin=9aSsQTUh8MXOsgpwPC8hotwXjk=XOFjHwiRa@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Bert Wesarg @ 2011-01-12  8:51 UTC (permalink / raw)
  To: Fei Zhao; +Cc: linux-c-programming

On Wed, Jan 12, 2011 at 09:49, Fei Zhao <skywalkzf@gmail.com> wrote:
> I have a question.
> For this case, how to use?When use it?

Sorry, I can't understand your question.

Bert

> Thanks!

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

* Re: printf *%f
       [not found]       ` <AANLkTin=9aSsQTUh8MXOsgpwPC8hotwXjk=XOFjHwiRa@mail.gmail.com>
@ 2011-01-12  9:02         ` Bert Wesarg
  2011-01-12  9:14           ` ratheesh k
  0 siblings, 1 reply; 7+ messages in thread
From: Bert Wesarg @ 2011-01-12  9:02 UTC (permalink / raw)
  To: Fei Zhao; +Cc: linux-c-programming

On Wed, Jan 12, 2011 at 09:59, Fei Zhao <skywalkzf@gmail.com> wrote:
> I mean's that when to use printf("%*.*f" , 4, 2 , x) ; in linux kernel or
> our practical use?

I don't know when you want to use such calls, how should I? And what
has the linux kernel to do with this, this doesn't came up before, and
what is '*our* practical use'?

Bert
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: printf *%f
  2011-01-12  9:02         ` Bert Wesarg
@ 2011-01-12  9:14           ` ratheesh k
       [not found]             ` <AANLkTinioDUcJ-1huPHJ3XoSkm63S14j5LzWOiQp7gmS@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: ratheesh k @ 2011-01-12  9:14 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Fei Zhao, linux-c-programming

On Wed, Jan 12, 2011 at 2:32 PM, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> On Wed, Jan 12, 2011 at 09:59, Fei Zhao <skywalkzf@gmail.com> wrote:
>> I mean's that when to use printf("%*.*f" , 4, 2 , x) ; in linux kernel or
>> our practical use?

If you want to control the format dynamically.
scanf("%d" , &first);
scanf("%d" , %second);
printf("%*.*f", first ,second , x);

> I don't know when you want to use such calls, how should I? And what
> has the linux kernel to do with this, this doesn't came up before, and
> what is '*our* practical use'?
>
> Bert
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: printf *%f
       [not found]             ` <AANLkTinioDUcJ-1huPHJ3XoSkm63S14j5LzWOiQp7gmS@mail.gmail.com>
@ 2011-01-12  9:53               ` Aniruddha Bhattacharyya
  2011-01-12  9:54                 ` Aniruddha Bhattacharyya
  0 siblings, 1 reply; 7+ messages in thread
From: Aniruddha Bhattacharyya @ 2011-01-12  9:53 UTC (permalink / raw)
  To: ratheesh k; +Cc: linux-c-programming

Use "%.*f" for Float    (its ".*" not "*")
and "%*d" for int

On Wed, Jan 12, 2011 at 3:22 PM, Aniruddha Bhattacharyya
<aniruddha.aot@gmail.com> wrote:
>
>
> Use "%.*f" for Float    (its ".*" not "*")
> and "%*d" for int
>
> Ref: http://www.cplusplus.com/reference/clibrary/cstdio/printf/
>
> On Wed, Jan 12, 2011 at 2:44 PM, ratheesh k <ratheesh.ksz@gmail.com> wrote:
>>
>> On Wed, Jan 12, 2011 at 2:32 PM, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
>> > On Wed, Jan 12, 2011 at 09:59, Fei Zhao <skywalkzf@gmail.com> wrote:
>> >> I mean's that when to use printf("%*.*f" , 4, 2 , x) ; in linux kernel or
>> >> our practical use?
>>
>> If you want to control the format dynamically.
>> scanf("%d" , &first);
>> scanf("%d" , %second);
>> printf("%*.*f", first ,second , x);
>>
>> > I don't know when you want to use such calls, how should I? And what
>> > has the linux kernel to do with this, this doesn't came up before, and
>> > what is '*our* practical use'?
>> >
>> > Bert
>> > --
>> > To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
>> > the body of a message to majordomo@vger.kernel.org
>> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> >
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: printf *%f
  2011-01-12  9:53               ` Aniruddha Bhattacharyya
@ 2011-01-12  9:54                 ` Aniruddha Bhattacharyya
  0 siblings, 0 replies; 7+ messages in thread
From: Aniruddha Bhattacharyya @ 2011-01-12  9:54 UTC (permalink / raw)
  Cc: linux-c-programming

Ref: http://www.cplusplus.com/reference/clibrary/cstdio/printf/

On Wed, Jan 12, 2011 at 3:23 PM, Aniruddha Bhattacharyya
<aniruddha.aot@gmail.com> wrote:
> Use "%.*f" for Float    (its ".*" not "*")
> and "%*d" for int
>
> On Wed, Jan 12, 2011 at 3:22 PM, Aniruddha Bhattacharyya
> <aniruddha.aot@gmail.com> wrote:
>>
>>
>> Use "%.*f" for Float    (its ".*" not "*")
>> and "%*d" for int
>>
>> Ref: http://www.cplusplus.com/reference/clibrary/cstdio/printf/
>>
>> On Wed, Jan 12, 2011 at 2:44 PM, ratheesh k <ratheesh.ksz@gmail.com> wrote:
>>>
>>> On Wed, Jan 12, 2011 at 2:32 PM, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
>>> > On Wed, Jan 12, 2011 at 09:59, Fei Zhao <skywalkzf@gmail.com> wrote:
>>> >> I mean's that when to use printf("%*.*f" , 4, 2 , x) ; in linux kernel or
>>> >> our practical use?
>>>
>>> If you want to control the format dynamically.
>>> scanf("%d" , &first);
>>> scanf("%d" , %second);
>>> printf("%*.*f", first ,second , x);
>>>
>>> > I don't know when you want to use such calls, how should I? And what
>>> > has the linux kernel to do with this, this doesn't came up before, and
>>> > what is '*our* practical use'?
>>> >
>>> > Bert
>>> > --
>>> > To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
>>> > the body of a message to majordomo@vger.kernel.org
>>> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>> >
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-01-12  9:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-12  7:39 printf *%f ratheesh k
2011-01-12  7:46 ` Bert Wesarg
     [not found]   ` <AANLkTi=f-TrLVC-S9PpY-HcLKgujNOtii7bG-U5tSPyy@mail.gmail.com>
2011-01-12  8:51     ` Bert Wesarg
     [not found]       ` <AANLkTin=9aSsQTUh8MXOsgpwPC8hotwXjk=XOFjHwiRa@mail.gmail.com>
2011-01-12  9:02         ` Bert Wesarg
2011-01-12  9:14           ` ratheesh k
     [not found]             ` <AANLkTinioDUcJ-1huPHJ3XoSkm63S14j5LzWOiQp7gmS@mail.gmail.com>
2011-01-12  9:53               ` Aniruddha Bhattacharyya
2011-01-12  9:54                 ` Aniruddha Bhattacharyya

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 NNTP newsgroup(s).