import struct


def read_strn(fp, pos, size):
    """Read N null-padded bytes into an ascii encoded string. Return value, position + N."""
    fp.seek(pos)
    val = struct.unpack("<" + str(size) + "s", fp.read(size))[0]
    return val.decode("ascii").strip("\0"), pos + size