I am trying to use getposin Perl. I am using an object FileHandlein the code below and does not seem to work. Can someone tell me what I am doing wrong?
getpos
FileHandle
use strict; use warnings; use FileHandle; my $fh = new FileHandle; $fh->open("<test.txt") or die "$!"; my $pos = $fh->getpos; print "pos: \"$pos\"\n";
Conclusion:
pos: ""
I expect "0" to be printed ...
Note the disclaimer (highlighted added) in the documentation :
C fgetpos fsetpos, FileHandle::getpos , FileHandle, FileHandle::setpos .
fgetpos
fsetpos
FileHandle::getpos
FileHandle::setpos
Opaque , : .
Perl tell seek?
tell
seek
#! /usr/bin/perl use warnings; use strict; open my $fh, "<", $0 or die "$0: open: $!"; print tell($fh), "\n";
0, .
0
FileHandle , , getpos, , , . , , setpos. , (fgetpos fsetpos), C fpos_t. seek tell, , , .
setpos
fpos_t
Source: https://habr.com/ru/post/1751825/More articles:Colon in JSON string - jsonUsing urllib2 with Jython 2.2 - pythonBalancing Value Sets - algorithmMySQL: UPDATING a row without a guaranteed unique field - sqlRuby on Rails: Cucumber: how to check if a link opens in a new window / tab? - ruby-on-railsList of external sites - hyperlinkhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1751827/using-netbeans-desktop-applications-status-bar&usg=ALkJrhia9Xc7P6kxUYeB6W0Er4LPVGnp8wThe performance counter string was not in the correct C # format - c #Creating a Java binding to a Qt-based library - javaIs there an asctime_s () function that works for SYSTEMTIME structures in windows? - cAll Articles