import struct


def read_string(fid):
    """
    Read a null terminated string from *fid* and return the value.
    """
    s = ''
    while True:
        c_i = struct.unpack('<c', fid.read(1))[0]
        if c_i == '\0':
            break
        s += c_i
    return s