Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: To read Char-by-Char from a file

by eXile (Priest)
on May 12, 2005 at 13:41 UTC ( [id://456387]=note: print w/replies, xml ) Need Help??


in reply to To read Char-by-Char from a file

sysread(FILE,$buffer,1);

Replies are listed 'Best First'.
Re^2: To read Char-by-Char from a file
by polettix (Vicar) on May 12, 2005 at 18:21 UTC
    Absolutely. This has the added benefit to bypass Perl's buffered IO, which is what one really wants if (s)he needs to read a precise amount of data from a "source".

    In addition, if you want to read byte-by-byte instead of char-by-char (which is different due to Unicode support), it's safer to use binmode:

    binmode FILE; sysread(FILE,$buffer,1);

    Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

    Don't fool yourself.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-25 15:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found