Update C generator to write out read/write functions