
Aug. 23, 2005
11:57 a.m.
Arnd Baecker wrote: and bunch of good stuff, and
... fp=file("x.dat","wb") io.fwrite(fp,len(x),x) fp.close() ... # --- and read them back fp=file("x.dat","rb") x_read=io.fread(fp,10,"d") fp.close()
Remark: `"wb"` and `"rb"` is only needed under Windows, normally `"w"` and `"r"` would be enough.
This is only true if you are talking about Unix/Linux vs. Windows. There are other systems where the 'b' is necessary, and even where it makes no difference it explicitly states your intent. So, I'd always use "wb" or "rb" in these cases. On some filesystems, (VMS comes to mind) a text file is a completely different format from a binary file. --Scott David Daniels Scott.Daniels@Acm.Org