C extension to open and r/w from files