Re: Printf fails on large files

From: Date: Sun, 19 Aug 2001 05:01:09 +0000
Subject: Re: Printf fails on large files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63352@lists.php.net to get a copy of this message
Hello, I don't think the problem you have is not the size of the file. It seems to depend on the content of that. (line 1) $a = 'abc%d'; (line 2) printf( "$a" ); will cause too-few-arguments error because variable $a contains the sequence of '%','d', which should be interpreted as formatting characters if you don't want it. use print() instead of printf(), or do like this: printf ( "<font color=blue>%s</font>\n", $conteudo );h Moriyoshi "In駻cia Sensorial Trabalhando" <inerteARROBAhotmail.com@pb1.pair.com> wrote: > He said no, here's the error: > > Warning: printf(): too few arguments in /htdocs/content.php on line 20 > > And here's the code. Remember that only fails on large files: > > <html> > <!-- GBJ --> > <head> > <title>SITUAヌテO DA CAIXA POSTAL</title> > </head> > <body> > Resultado da Consulta para: <b><? printf ($login_usuario) ?></b>. > <pre> > <?php > opendir ("/var/mail"); > chdir ("/var/mail"); > // A vari疱el $login_usuario obtida em index.html > // xxx.xxx.com.br/gbj/index.html > if (file_exists("$login_usuario")) { > printf ("<b>SITUAヌテO DA CAIXA POSTAL</b>\n\n"); > $situacao = ls -ld $login_usuario; > printf ("<font color=blue>$situacao</font>\n"); > printf ("<b>CONTEレDO DA CAIXA POSTAL</b>\n\n"); > $conteudo = mailx -H -f /var/mail/$login_usuario; > printf ("<font color=blue>$conteudo</font>\n"); > } > else > { > printf ("O usu疵io $login_usuario <b>n縊 foi encontrado</b>.\n"); > } > ?> > </pre> > </body> > </html> > > -- > > Julio Nobrega > > A hora est chegando: > http://toca.sourceforge.net > "John Meyer" <john_meyer@geocities.com> wrote in message > news:5.1.0.14.0.20010817142852.009f4c10@pop.mail.yahoo.com... > At 05:14 PM 8/17/01 -0300, In駻cia Sensorial Trabalhando wrote: > > Hi All, > > > > A friend of mine said his printf is failing when he parses a variable > from > >a 4.5 mega file. On smaller files, it works fine. > > > > There's a limit on the printf or somewhere else? > > > > Thanks. > > > Is he throwing the _entire_ 4.5 MB file into that variable and trying to > print that? > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#63352) next »