(toppers-users 327) Re: sprintf は使えますか?
h-iwamoto @ kit.hi-ho.ne.jp
h-iwamoto @ kit.hi-ho.ne.jp
2001年 11月 19日 (月) 21:25:57 JST
岩本と申します。
これも些細なことですが。。
宮島 和彦 さんは書きました:
>おはようございます。東北アルプス(株)宮島と申します。
>
>今年の5月くらいからROMさせて頂いております。
>今回、些細なことなんですけど、
>
>> double x,y;
>> ・
>> ・
>> sprintf(buf,"%6.4f",y);
>
>Cコンパイラによって異なるようですが、自分の経験では
>doubleをsprintfやprintfする場合、
> v
> sprintf(buf,"%6.4lf",y);
>
>のようにfの前にl(L)を入れる必要があるはずです。
>一度、お試しください。
>
それはscanfです。
printfではあってもなくても同じです。
C99 7.19.6.1
+++++++++++++++++++++++++
l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
long int or unsigned long int argument; that a following n
conversion specifier applies to a pointer to a long int argument; that a
following c conversion specifier applies to a wint_t argument; that a
following s conversion specifier applies to a pointer to a wchar_t
argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
specifier.
+++++++++++++++++++++++++
>-------------------------------
> 東北アルプス(株) 宮島 和彦
>-------------------------------
----
岩本 秀樹 h-iwamoto @ kit.hi-ho.ne.jp