on 7/7/01 7:38 PM, mike cullerton at [EMAIL PROTECTED] wrote:

> on 7/7/01 7:02 PM, Jeff Lewis at [EMAIL PROTECTED] wrote:
> 
>> So I need to know how to process the files in the directory and then how to
>> process a few lines.  The structure will always be the same and having the
>> columns starting at the same position each time.
> 
> first, do the files have all the heading info in them as well, or just the
> data? ie, are all the lines the same, or are there some that include stuff
> other than data?
> 
> if the files cantaon only data, once you get a file in hand, this can parse
> the lines.
> 
> $fd = fopen ($file,'r');

  oops, missed something...

  while (!feof ($fd)) {

> $buffer = fgets($fd, 4096);
> $field1 = substr($buffer,0,x);
> $field2 = substr($buffer,x,y);
> $field3 = substr($buffer,x+y,z);
> ...
> 
> where x is the length of the first field, y length of the second ...
> 
> also, you may want to trim() the fields.
> 
> i'm sure others around here can come up with something better.
> 
> :)
> 
> -- mike cullerton
> 


 -- mike cullerton



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to