MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 2 | string read_file(string file, int start, int number, string encoding) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 4 | DESCRIPTION |
| 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 9 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 10 | If <number> is not given or 0, the whole file is read, else |
| 11 | just the given amount of lines. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 12 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 13 | <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. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 16 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 17 | If <start> would be outside the actual size of the file, 0 is |
| 18 | returned instead of a string. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 19 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 20 | The maximum number of characters (not lines!) being read per |
| 21 | call is LIMIT_FILE (see query_limits()). |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 22 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 23 | HISTORY |
| 24 | LDMud 3.6.0 added the <encoding> parameter. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 25 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 26 | SEE ALSO |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 27 | read_bytes(E), write_file(E), hooks(C) |