Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: File seek

by Anonymous Monk
on Feb 25, 2013 at 10:37 UTC ( #1020492=note: print w/replies, xml ) Need Help??


in reply to Re: File seek
in thread File seek

I am seeking to -500 as i know that the keyworn(<run>)wil be in last 500 characters

Replies are listed 'Best First'.
Re^3: File seek
by Anonymous Monk on Feb 25, 2013 at 10:45 UTC

    I am seeking to -500 as i know that the keyworn(<run>)wil be in last 500 characters

    no you aren't, seek doesn't take negative offsets, like the error message I showed says

      From the documentation

      The values for WHENCE are 0 to set the new position in bytes to POSITION; 1 to set it to the current position plus POSITION; and 2 to set it to EOF plus POSITION, typically negative.

      I suspect your error message is because you are trying to seek to a negative offset from the beginning of the file.

      Cheers,

      JohnGG

      seek (file, distance, from)

      As you can see, seek requires three arguments:

      file: which is the file variable representing the file in which to skip

      distance: which is an integer representing the number of bytes (characters) to skip

      from:which is either 0, 1, or 2

      0 - The number of bytes to skip from beginning of the file.

      1 - The number of bytes to skip from current location of the file.

      2 - The number of bytes to skip from end of the file.

      seek(CONFIRMEDOUTPUTFILE, -500, 2);

      The above line skip backward 500 bytes from the end of the file.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020492]
help
Chatterbox?
[1nickt]: Ah, I see. I did read some gamer mag reviews, and yes, they lamented the fact that laptops with no discrete video card are sold as "gaming" hardware.
[1nickt]: But, they do have red keyboard backlighting! And gargoyles on the front, or words like "Maxxx" here and there. They know their demographic!
[1nickt]: True gamers don;t buy Dells, HPs, or Lenovos, I think ;-)
[ambrus]: The keyboard I bought doesn't have backlighting. I specifically had to select for that, because so many keyboards these days have lights. Why would I want lights in the keyboard? I want lights in the room, such as on the ceiling, not in the keyboard.
choroba has a small USB lamp
[ww]: ++ all (phony labels re "gaming"
[1nickt]: ambrus perhaps you know where the keys are?

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (14)
As of 2017-03-27 13:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.