re: Overwriting specific lines in text files without rewriting the whole thing.
| From: | Bill Rausch | Date: | Tue, 27 Jun 2000 15:03:52 +0000 |
| Subject: | re: Overwriting specific lines in text files without rewriting the whole thing. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3348@lists.php.net to get a copy of this message | ||
Since your ISP doesn't have MySQL or similar available for you, you might
try writing a small C program that uses open(), lseek(), read(), and
write() to do your "in-place" updating, and then call it from your php
using exec() or system(). The C program itself would be a small one. If
you need to support multiple simultaneous users then you could add "record
locking" or "file locking" so the processes don't interfere with each other.
open file
find record
get lock
read record
change record
write record
release lock <-- optional since close() does it for you
close file
Bill
---
Bill Rausch, Software Development, Unix, Mac, Windows
Numerical Applications, Inc. 509-943-0861 bill@numerical.com