blob: a05fa1c960c4581c74d5a879671aee0e914a833e [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstra715ec202025-07-09 22:18:31 +02002 string read_file(string file, int start, int number, string encoding)
MG Mud User88f12472016-06-24 23:31:02 +02003
Zesstra715ec202025-07-09 22:18:31 +02004DESCRIPTION
5 Reads lines from file.
6 If <start> is not given or 0, the file is read from the
7 beginning, else the efun starts reading at the beginning of line
8 <start>.
MG Mud User88f12472016-06-24 23:31:02 +02009
Zesstra715ec202025-07-09 22:18:31 +020010 If <number> is not given or 0, the whole file is read, else
11 just the given amount of lines.
MG Mud User88f12472016-06-24 23:31:02 +020012
Zesstra715ec202025-07-09 22:18:31 +020013 <encoding> denotes the encoding to be used for decoding the file.
14 If it is not given or 0, the H_FILE_ENCODING driver hook will
15 be used.
Zesstrad59c3892019-11-28 20:53:39 +010016
Zesstra715ec202025-07-09 22:18:31 +020017 If <start> would be outside the actual size of the file, 0 is
18 returned instead of a string.
MG Mud User88f12472016-06-24 23:31:02 +020019
Zesstra715ec202025-07-09 22:18:31 +020020 The maximum number of characters (not lines!) being read per
21 call is LIMIT_FILE (see query_limits()).
MG Mud User88f12472016-06-24 23:31:02 +020022
Zesstra715ec202025-07-09 22:18:31 +020023HISTORY
24 LDMud 3.6.0 added the <encoding> parameter.
Zesstrad59c3892019-11-28 20:53:39 +010025
Zesstra715ec202025-07-09 22:18:31 +020026SEE ALSO
Zesstrad59c3892019-11-28 20:53:39 +010027 read_bytes(E), write_file(E), hooks(C)