I believe the problem you face is that the files you are dealing with have
no concept of "a record."  Instead, as far as the operating system is
concerned, the file is just one long string of characters, some of which MAY
be newlines.  In particular, sysread() reads a fixed number of bytes whether
or not they include newline characters.

Mainframe file systems often DO have a clear notion of a record which the
file system recognizes uniquely.  In those cases, there is usually some way
to delete individual records.

Someone else may come up with a bright idea, but you may be forced to read
the old file, writing a new file as you go with the records removed.  When
you are finished, rename the old file to a temporary name as a backup
measure.  Rename the new, edited file to the old file name.  Only after all
of that has been done safely do you then finally delete the old file under
its temporary name.

Merrill

> -----Original Message-----
> From: Eric C. Hansen [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, February 22, 2000 4:32 PM
> To:   [EMAIL PROTECTED]
> Subject:      [perl-win32-gui] deleting rows from a textfile in place
> 
> Hi. I am writing a Win32::GUI application to open a fixed length record
> text
> file for
> viewing/editing.
> 
> I am using low level sysreads() and syswrites() to read and write to the
> file.
> 
> I am supposed to program the application to allow deleting of records.
> 
> I am not a C programmer, so I am not familiar with the write function in
> C.
> Is there an easy way to delete a record with the C write function? Has
> anyone done it with
> syswrite in Perl?  I thought maybe writing an octal "\0177" would do it
> but
> I can't
> get that to work. Nor can I get writing null to work. What is the correct
> way to delete
> a record in a text file? (records are fixed length 307 including
> linefeed).
> 
> Thanks,
> Eric H.
> 


Reply via email to