1 创建目录
- 方式一
try
make_dir ('dir')
catch (Exception)
* 使用try catch 防止重复创建报错
endtry
- 方式二
Path:='dir'
file_exists (Path, FileExists)
if (FileExists==0)
open_file (Path, 'output', FileHandle)
close_file (FileHandle)
endif
2 文本读写
- 文本写入
open_file (Path, 'append', FileHandle)
fwrite_string (FileHandle, '123,456,789')
fnew_line (FileHandle)
close_file (FileHandle)
- 文本读取
open_file (Path, 'input', FileHandle)
repeat
fread_string (FileHandle, OutString, IsEOF)
until (IsEOF)
close_file (FileHandle)
3 其他辅助功能
- 获取系统时间
get_system_time (MSecond, Second, Minute, Hour, Day, YDay, Month, Year)
- 格式化
形如 Tuple := 123.456$'.2',其中'.2'是格式化字符串。可替代为
#o | 8进制 |
#x或#X | 16进制 |
#f | double |
#g或#G | 6位,不足补0,超过用e |
#e或#E | 转换成科学计数 |
n | 小于n位,文本右对齐 |
-n | 小于n位,文本左对齐 |
.n | (整数)小于n位,左侧补0 (小数)保留n位,四舍五入 |
m.n | 小于m位,文本右对齐;小于n位,左侧补0 |
.ne | (小数)保留小数点后n位,不足补0 |