RE: [PHP] Re: File Random Access
| From: | Mark Charette | Date: | Thu, 31 Oct 2002 04:26:04 +0000 |
| Subject: | RE: [PHP] Re: File Random Access | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122190@lists.php.net to get a copy of this message | ||
-----Original Message-----
From: David Robley [mailto:robleyd@paradise.net.nz]
I'm going to stick my neck out here - as I understand it, this is not an
omission in php, rather it is a restriction of the underlying OS/file
system. <Extends neck more> To the best of my knowledge, neither the FAT
based system of M$DOS or e2fs under *nix will allow random access _to the
contents of a specific file_ without the need to read/rewrite the
entire file. Is there in fact any file system that allows this?
----
All of the file systems I have ever worked with over the last 25 years allow
random read/writes (via calls similar to fseek() ); however, random writes
involve fixed-length blocks if you want to re-write in place. PHPs fseek()
will allow you to do random read/writes on fixed length blocks just like the
underlying C call.
Variable length blocks (say, those ending in random new lines) are by
definition non-deterministic; therefore re-writes in place are impossible
without OS help in inter-block jumps/relinks and the subsequent waste of
file space. The Pick O/S from a long time back allowed something like this
if I remember right (Pick Systems is now RainingData markets a high-end
database) .
Mark C.