Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: What specifically is the "file position"?

by beable (Friar)
on Jul 24, 2004 at 03:00 UTC ( #377065=note: print w/replies, xml ) Need Help??


in reply to What specifically is the "file position"?

You could try asking the computer:
#!/usr/bin/perl use strict; use warnings; use Fcntl 'SEEK_END'; my $filename = "testfile"; create_file(); seek_file(); sub create_file { my $size = 4096; open OUTFILE, ">$filename" or die "can't open $filename: $!"; print OUTFILE "x" x $size or die "can't print to $filename: $!"; close OUTFILE or die "can't close $filename: $!"; } sub seek_file { open INFILE, "<$filename" or die "can't open $filename: $!"; my $result = sysseek INFILE, 0, SEEK_END; close INFILE; print "sysseek() returned $result\n"; } __END__ Output: sysseek() returned 4096

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://377065]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2023-03-21 04:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (59 votes). Check out past polls.

    Notices?