Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Feb 1999 14:07:15 -0500 (EST)
From:      Thomas David Rivers <rivers@dignus.com>
To:        Hackers@FreeBSD.ORG, Matthew.Alton@anheuser-busch.com
Cc:        Matt.Ladendorf@anheuser-busch.com
Subject:   Re: printf wierdness
Message-ID:  <199902261907.OAA14251@lakes.dignus.com>
In-Reply-To: <BED2E68B5FB4D21193C90008C7C56836564C53@STLABCEXG012>

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Why is this happening?
> 
> 
> $ vi foo.c
> 
> #include <stdio.h>
> 
> int
> main(void)
> {
>  unsigned long long int foo = 0;
>  char *bar = "Hidely Ho!";
> 
>  (void)printf("%llu    %s\n", foo, bar);
>  (void)printf("%s    %llu\n", bar, foo);
> 
>  return 0;
> }

 I believe you've got the wrong printf() specifications.

 I think you want:

	printf("%qu  %s\n", foo, bar);
	printf("%s   %qu\n", bar, foo);


	- Dave R. -


> foo.c: 14 lines, 196 characters.
> $ make foo
> cc     foo.c   -o foo
> $ ./foo
> 0    (null)
> Hidely Ho!    0
> $ 
> 
> Matthew Alton
> Computer Services - UNIX Systems Administration
> (314)632-6644   matthew.alton@anheuser-busch.com
>                 alton@plantnet.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902261907.OAA14251>