Function readEPShortString

Reads a string in standard Pascal shortstring format.

string readEPShortString (
  ushort capacity,
  std.stdio.File file
);

In this format, the first written byte represents the length of the string. The string itself follows, truncated or padded with '\0' upto capacity.

Parameters

NameDescription
capacity The length of the data section to be read, excluding the one byte prefix.
file The file to read from.

Returns

the string as read from file.

See Also

writeAsEPShortString, readEPString.

Example

enum str = "Jan Karel is een proleet";
import std.stdio;
File tmp = File.tmpfile();
writeAsEPShortString(str, 80, tmp);
tmp.flush;

assert(tmp.size == 81);

tmp.rewind;
assert(readEPShortString(80, tmp) == str);