RE: [PHP] fwrite
| From: | Scott | Date: | Mon, 11 Feb 2002 14:21:22 +0000 |
| Subject: | RE: [PHP] fwrite | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84270@lists.php.net to get a copy of this message | ||
It has to be text formatted for a mainframe import routine. So, field 1
may only be 12 characters, but I need to make it always be 30. Field 2
might be 8 characters, but I need to leave 15 open.
On Mon, 11 Feb 2002, Rick Emery wrote:
> Does the file have to be formatted as text, or can it binary? If binary is
> good, then you don't need fprintf() functionality.
>
> -----Original Message-----
> From: Scott [mailto:scott@scottah.com]
> Sent: Monday, February 11, 2002 8:14 AM
> To: Rick Emery
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] fwrite
>
>
> Thanks Rick, the sprintf would give me the formatting, but I am printing
> out about 100 fields to this file on each loop and was looking for a
> better way to include them as part of the statement. In other words, by
> saying that NEWQUOTES is my file hadle, each line I would be able to do
> this:
>
> print NEWQUOTES "variables"
>
> Thanks,
>
> -Scott
>
>
>
>
>
>
> On Mon, 11 Feb 2002, Rick Emery wrote:
> > sprintf()
> > then fwrite()
>
>
>
>
>
>
> > -----Original Message-----
> > From: Scott [mailto:scott@scottah.com]
> > Sent: Monday, February 11, 2002 7:48 AM
> > To: php-general@lists.php.net
> > Subject: [PHP] fwrite
> >
> >
> > Sorry for the simple questions, but I am converting this perl app to php
> > and one of the things I do is write out a file doing this:
> >
> > open(NEWQUOTES, ">qiv_export.txt");
> >
> > Then when I want to write data to it I do this:
> >
> > printf NEWQUOTES ("%04d%02d%02d%-4s", report_time(), "0001");
> >
> > Is this possible with fwrite? It would be easier than:
> > fwrite($exportfile, " ");
> > fclose($logfile);
> > and escaping all the double quotes.
> >
> > Thanks in advance.
> >
> > -Scott
> >
> >
> >
>
>
--