printf in linux

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

3 posts / 0 new
Last post
printf in linux

Submitted by Anonymous on Thu, 02/13/2003 - 14:23.

Hi all,

I know this not a motif question, but I figured this is just as good a place to ask this.

Does Linux support int64 formatting with printf ? I have a multi-os apps that needs to display full int64 and I can do that under Windows but I was wondering if the same thing can be done under Linux?

Tx

Mon, 02/24/2003 - 07:21#1

Mon, 02/24/2003 - 07:21#1

Anonymous

printf in linux

Generally you shouldn`t use int64 in multi-os apps since it is no standart type or was it since C99 ?

If linux supports int64 printfs is affected by the libc that gets used, which is glibc in 99.9%. Of course older versions of glibc might lack that 64 bit support. Newer versions will of course.

Other Unices (UNIXes?) will support different printf standarts. Though most modern systems should support C99.

Its up to you if you want to rely on ANSI C99. I recommend against the usage of printf at all but you can use any C99 syntax with a modern linux or any other modern UNIX System.

Just take care if you want to port your application to this old UNIX computer in the cellar of your Universities Computing Departement ;-)

Hmm I just read this documentation here, which says the %lld, %Ld %qd %lli %Li and %qi flags will work on GNU and BSD systems, which is linux and FreeBSD. BUT this is no ANSI ISO ! Though %ld does on 64bit systems.

Wed, 02/26/2003 - 19:34#2

Wed, 02/26/2003 - 19:34#2

Anonymous

printf in linux

Thanks, that helped. We will probably need to use a set of define, macro and pre-processor information to set ourselves correctly.