RE: print to a specific location in a file





-----Original Message-----
From: Brian Volk
Sent: Monday, August 01, 2005 11:03 AM
To: Beginners (E-mail)
Subject: print to a specific location in a file


Hi All~

Is it possible to open a file and print to a specific location in the file?
For example, I have a 1K file and 0 - 511 is where the small description is
stored and starting in position 512 is the path to a pdf file.... If I do
not have the path in position 512 the link will be broken on web site. Pls
let me know if this is possible and where I can read about it.

Thanks!

Brian Volk
----------------------------------------------------------------------------
----
I think I found what I was looking for... ( seek / read )

#!/usr/local/bin/perl

use strict;
use warnings;

my $txt_file = "C:/brian/descriptions/product/small/70413.txt";
open (FILE, $txt_file) or die "can't open $txt_file: $!\n";

my $link;

seek (FILE, 256, 0);
read (FILE, $link, 150);

print $link;
---------------------------------------------------
now I just hope I can open the file replace the data in that byte
position... :~)

Thanks,

Brian



Relevant Pages

  • RE: File::Find if match rename
    ... > To: Brian Volk ... > Cc: Beginners ... > If the PDF files are in a given directory (and not hidden in various ... Have two parallel arrays ...
    (perl.beginners)
  • print to a specific location in a file
    ... stored and starting in position 512 is the path to a pdf file.... ... not have the path in position 512 the link will be broken on web site. ... Brian Volk ... Prev by Date: ...
    (perl.beginners)
  • Re: /$RE{URI}{HTTP}{-keep}/;
    ... On Tuesday 15 February 2005 11:06 am, Brian Volk wrote: ... > use warnings; ... > use strict; ... > use Cwd; ...
    (perl.beginners)
  • match basename file and s / / /;
    ... # read file/directory names in that directory into @htmls ... Brian Volk ... Prev by Date: ...
    (perl.beginners)
  • Re: convert image sizes
    ... Brian Volk wrote: ... >>use warnings; ... >>use strict; ... > What does umask 0022 do? ...
    (perl.beginners)