Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^11: Question about binary file I/O

by ikegami (Patriarch)
on Mar 05, 2011 at 09:16 UTC ( [id://891550]=note: print w/replies, xml ) Need Help??


in reply to Re^10: Question about binary file I/O
in thread Question about binary file I/O

I think you mean print (buffered by default) or syswrite (unbuffered)? write is not the opposite of read

Replies are listed 'Best First'.
Re^12: Question about binary file I/O
by tilly (Archbishop) on Mar 05, 2011 at 10:45 UTC
    Gah, I've been playing with Python too much. You're right.
      So there is no single function that does that...well, that just sucks. I was hoping I could do it without needing seek(), but I guess if that's the only way, I don't have much of a choice. Isn't there a website somewhere where you can suggest features for the next version of Perl? That would be at least the second thing that I could think of.
        I was hoping I could do it without needing seek(),

        Why not just hide the seek inside a function of your own? Something like:

        sub printAt { my( $fh, $src, $nChars, $offset ) = @_; seek $fh, $offset, 0; return print $fh substr $src, 0, $nChars; } printAt( $fh, $s, 4, 1234 );

        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-04-19 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found