本章主要展示有关外部文件的代码参考,比如读写文本文件、用文本文件记录日志、从文本文件中读出序表、用文本文件保存序表等。
|
A |
|
1 |
=file("D:\\test.txt") |
|
2 |
>A1.write("USA") |
写出字串 |
3 |
=A1.read() |
读文本文件,以字串返回 |
|
A |
|
1 |
=file("D:\\test.log") |
|
2 |
>A1.write@a(string(now())+": Start getting data") |
"@a" 表示追加写出 |
|
A |
|
1 |
=file("D:\\employee.txt") |
|
2 |
=A1.import() |
|
3 |
=A1.import@t() |
第一行用作字段名 |
|
A |
|
1 |
=demo.query("select EID,NAME,STATE, GENDER, BIRTHDAY,HIREDATE,DEPT, SALARY from EMPLOYEE") |
|
2 |
=file("D:/employee.txt") |
|
3 |
>A2.export(A1) |
|
4 |
>A2.export@t(A1) |
将字段名作为标题 |