Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Using the seek function to go to a certian byte range

ReddyfireReddyfire Posts: 3Member
So I'm trying to use the seek function to seek a couple of lines of the file without going to the end of the file. Just trying to stay within a certain byte range. Here is my code.

#!/usr/local/bin/perl
print "content-type: text/html

";
open (FILE, "< file.txt") or die("File not found");
seek FILE, 21,0;
while()
{
print;
}
close(FILE);
exit;

What would I need to do to only stay within a certain byte range and display the text only in that byte range without going to the end of the file. I have looked all over but can't seem to figure out how to do this without going to the end of the file.
Sign In or Register to comment.