Record in Text files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,
I have a little problem with storing records in text files.

I have an internal email control where the messages are stored in a text 
file, follow is the format:
Record Format (# delimited format)
    ==================
    [Header  125 bytes]
    0           0/1  (Record status)
    1           Record Length
    2           EmailID  [Sender-Reader-time()]
    3           [S]sent, [I]nbox, sa[V]ed
    4           Time
    5           Sender
    6           SenderName
    7           Receiver
    8           [R]ead/[U]nread
    9           [N]ormal,[U]nlock photos
    10          Subject
    [Record]   
    *           Base64Encoded, gzipped, serialized  ttMail "class" record. 

Until now everything is working fine, except the *remove* record.

I need to proceed a while in this file and *remove* the record where the 
*Record Status* is 0

Example how I that:
    while (!feof($fp)){
        $record_loc = ftell($fp);
        $record = fread($fp,125);
        if($record !== false){
            list($inuse,
                $rlength,
                $ident,
                $type,
                $time,
                $sender,
                $sendername,
                $receiver,
                $read_status,
                $special,
                $subjectline) = split("#",$record);
            if($rlength > 0){
                $obj = unserialize(gzinflate(base64_decode($data)));
                //echo $obj->Body."<br>";
            }
        }
    }
    $record_loc = null;     

I dont know how to remove the record from the file, any ideas?

Thanks
F.


PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux