Perl

Moderators: Jonathan
Number of threads: 1259
Number of posts: 3644

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Using the seek function to go to a certian byte range Posted by Reddyfire on 2 Dec 2008 at 12:48 PM
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\n\n";
open (FILE, "< file.txt") or die("File not found");
seek FILE, 21,0;
while(<FILE>)
{
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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.