“文件输入输出”的版本间差异

来自Shiyin's note
跳到导航 跳到搜索
(以“*文件打开 : openr,lun,/get_lun ;读取 :: readf读取 : openw,lun,/get_lun ;写入 :: printf写入 ::: 格式使用 format语句 * 将文件指针指向...”为内容创建页面)
 
无编辑摘要
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
*判断一个文件是否存在
:xidl中有一个exist程序
::if exist('input.dat') then print,'Yes' else print,'No'

*文件打开
*文件打开
: openr,lun,/get_lun ;读取
: openr,lun,/get_lun ;读取
第4行: 第8行:
: openw,lun,/get_lun ;写入
: openw,lun,/get_lun ;写入
:: printf写入
:: printf写入
::: 格式使用 [[format语句]]
::: 格式使用 [[format格式符|format语句]]


* 将文件指针指向文件开头
* 将文件指针指向文件开头

2012年4月7日 (六) 13:16的最新版本

  • 判断一个文件是否存在
xidl中有一个exist程序
if exist('input.dat') then print,'Yes' else print,'No'
  • 文件打开
openr,lun,/get_lun ;读取
readf读取
openw,lun,/get_lun ;写入
printf写入
格式使用 format语句
  • 将文件指针指向文件开头
point_lun,lun,0
  • 跳过文件开头n行
skip_lun,lun,N,/lines
  • 判断是否达到文件结束 EOF
WHILE ~ EOF(lun) DO BEGIN ; ~ 逻辑非运算
   READF,lun, A 
ENDWHILE 
  • 文件指针关闭close之后,还需要释放free_lun