mode of reading and writing files:
Copy Code code as follows:
R-Read mode W-write mode (overwrite existing content)
A-attach mode (after existing content is attached)
B-Binary mode
r+-Read update mode (existing data retention)
w+-Write update mode (existing data erasure)
A +-Additional update mode (existing data retention, only appended to the end of the file)
' do--read data from File function ReadFile () Local filehandle = assert (Io.op
En ("test.txt", "R"), "not the file");
If FileHandle then local outdata = Filehandle:read ("*all");
Print (Outdata);
else print ("false");
End Filehandle:close (errorinfo); End--write data to the file function WriteFile (databuffer) Local writehandle = assert (Io.open ("Write.txt", "
A + ")," not the file ");
If Writehandle then Writehandle:write (DataBuffer);
Print ("true");
else print ("false");
End Writehandle:close ();
End local Inputdata = 0; Repeat Inputdata = Io.read ();
--write the data from IO WriteFile (inputdata); Until Inputdata = = ' # ' End