ReadPrefixedString ( void ptr, byte buffer, int bufferLen, int error ) : int |
Reads a length-prefixed string as generated by a .NET BinaryReader class. This involves first reading a variable-size 7-bit integer, then the string, placing it in the provided buffer. If the buffer is not large enough, the 'error' parameter is set to 1. The string is still readable in 'buffer', but it is shortened. To prevent this, you can call Read7BitEncodedInt first and size the buffer appropriately. Returns the amount of bytes that the length-prefixed string took up (including the bytes that contained the length), so it can be skipped when reading more data. The 'buffer' will be null-terminated, even if it is too small. The returned value is not reduced if the buffer is too small (IE, it represents the entire string, not the shortened version). |
|