Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schwern/file-fgets
Read either one line or X characters from a file
https://github.com/schwern/file-fgets
Last synced: about 1 month ago
JSON representation
Read either one line or X characters from a file
- Host: GitHub
- URL: https://github.com/schwern/file-fgets
- Owner: schwern
- License: other
- Created: 2010-05-28T21:22:25.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2010-06-01T20:41:48.000Z (over 14 years ago)
- Last Synced: 2024-10-29T20:10:48.148Z (3 months ago)
- Language: C
- Homepage: http://search.cpan.org/dist/File-fgets
- Size: 152 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
NAME
File::fgets - Read either one line or X characters from a fileSYNOPSIS
use File::fgets;open my $fh, $file;
# Read either one line or the first 10 characters, which ever comes first
my $line = fgets($fh, 10);DESCRIPTION
An implementation of the C fgets() function.fgets
my $string = fgets($fh, $limit);Reads either one line or at most $limit bytes from the $fh.
Returns undef at end of file.
NOTE: unlike C's fgets, this will read $limit characters not $limit - 1.
Perl doesn't have to leave room for a null byte.EXAMPLE
The following example demonstrates using fgets() to read in at most 5
characters at a time.use File::fgets;
open my $write_fh, ">", $file;
print $write_fh <.This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.See http://www.perl.com/perl/misc/Artistic.html
Send bugs, feedback, ideas and suggestions via
https://rt.cpan.org/Public/Dist/Display.html?Name=File-fgets or
The latest version of this software can be found at
http://github.com/schwern/File-fgetsSEE ALSO
File::GetLineMaxLength