Change..
to..
WriteInt(fileout,x$) WriteInt(fileout,y) WriteInt(fileout,z#)
to..
WriteString(fileout,x$) WriteInt(fileout,y) WriteFloat(fileout,z#)