Re: need to generate fixed-length file
| From: | Robert Cummings | Date: | Wed, 06 Sep 2006 20:57:05 +0000 |
| Subject: | Re: need to generate fixed-length file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241427@lists.php.net to get a copy of this message | ||
On Wed, 2006-09-06 at 16:56 -0400, Karen Goeller wrote:
> I'm having trouble generating a fixed-length (i.e., non-delimited) file
> format out of PHP 4, based on queries out of MySQL. These files are
> getting imported into a Unidata database and require a very specific
> byte-mapping format. However, while the fopen used with length will
> TRUNCATE to a specific length, it also won't pad to that length.
>
> Is there a function I'm missing somewhere that will let you specify a
> field length and pad accordingly? If not, any suggestions as to
> approach will be greatly appreciated!
str_pad()
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'