fopen( ) 函数示例

if file('errors.txt')  && 文件存在吗?
	gnerrfile = fopen('errors.txt',12)  && 如果存在,以读写方式打开
else
	gnerrfile = fcreate('errors.txt')  && 如果不存在,创建文件
endif
if gnerrfile < 0  && 检查文件打开时的错误
	wait 'cannot open or create output file' window nowait
else  && 如果没有错误,则写文件
	=fwrite(gnerrfile, 'error information to be written here')
endif
=fclose(gnerrfile)  && 关闭文件
modify file errors.txt nowait  && 在编辑窗口中打开文件