linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Howto print off_t
@ 2002-06-26 21:30 Holger Kiehl
  2002-06-27  6:09 ` Glynn Clements
  0 siblings, 1 reply; 7+ messages in thread
From: Holger Kiehl @ 2002-06-26 21:30 UTC (permalink / raw)
  To: linux-c-programming

Hello

What is the best way to print an off_t variable. On a 32 bit machine
you can print it with %ld and on a 64 bit machine you need to print
it with %lld. One could code this as follows:

    if (sizeof(off_t) == 4)
       printf("%ld\n", off_t_var);
    else
       printf("%lld\n", off_t_var);

But is this portable? Do all implementations know about %lld? Don't
some of them use %Ld or some other syntax.

Or is there a better way of doing this? I don't like the above code
since it makes it ugly to read when you have to print lots of off_t's.

Thanks,
Holger


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

end of thread, other threads:[~2002-06-28  5:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-26 21:30 Howto print off_t Holger Kiehl
2002-06-27  6:09 ` Glynn Clements
2002-06-27 19:24   ` Andrew Edmondson
2002-06-27 20:54     ` Glynn Clements
2002-06-27 19:43   ` Holger Kiehl
2002-06-27 21:18     ` Glynn Clements
2002-06-28  5:00       ` Holger Kiehl

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).