fgets( ) 函数示例

*** test.txt 文件必须存在 ***
store fopen('test.txt') to gnfilehandle 	&& 打开文件
store fseek(gnfilehandle, 0, 2) to gnend	 && 移动指针到 eof
store fseek(gnfilehandle, 0) to gntop  	&& 移动指针到bof
if gnend <= 0  && 是“空”文件吗?
	wait window 'this file is empty!' nowait
else  && 如果非“空”
	gcstring = fgets(gnfilehandle, gnend)  && 存储内容
	? gcstring
endif
= fclose(gnfilehandle)  && 关闭文件