|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: % stdout?
From: Andreas Kahari (andreas.kahari
gmail.com)
Date: Thu Nov 09 2006 - 11:16:55 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Suppose the data in 'foo' comes from user input:
#include <stdio.h>
main()
{
char foo[] = "bar=30%\n";
fprintf(stdout, "%s", foo);
}
Andreas
On 09/11/06, Jason Dixon <jason
dixongroup.net> wrote:
> On Nov 9, 2006, at 11:37 AM, Cassio B. Caporal wrote:
>
> > Hey,
> >
> > I have problems to print '%' in stdout... Suppose code below:
> >
> > #include <stdio.h>
> >
> > main() {
> > char foo[] = "bar=30%\n";
> > fprintf(stdout, bar);
> > }
> >
> > OpenBSD returns : bar=30
> > Linux returns : bar=30%
> >
> > How can I solve this? Thanks,
>
> $ cat foo.c
> #include <stdio.h>
>
> main() {
> char foo[] = "bar=30%%\n";
> fprintf(stdout, foo);
> }
> $ gcc foo.c -o foo
> $ ./foo
> bar=30%
>
>
> --
> Jason Dixon
> DixonGroup Consulting
> http://www.dixongroup.net
>
>
--
Andreas Kahari
Somewhere in the general Cambridge area, UK
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]