⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 read_text_file.pro

📁 IDL语言编写的用于天文自适应光学仿真的软件CAOS V6.0的第一部分。
💻 PRO
字号:
; $Id: read_text_file.pro,v 1.2 2002/03/14 11:49:13 riccardi Exp $

function read_text_file, filename

openr, unit, filename, /GET_LUN
max_num_lines = 1000
buffer = strarr(max_num_lines)

is_first = 1B
on_ioerror, at_eof
while 1B do begin
	readf, unit, buffer
	if is_first then begin
		tot_buffer = buffer
		is_first = 0B
	endif else tot_buffer = [temporary(tot_buffer), buffer]
endwhile

at_eof:
on_ioerror, null
n_lines = (fstat(unit)).transfer_count
if n_lines gt 0 then begin
	if is_first then begin
		tot_buffer = buffer[0:(n_lines-1)]
	endif else begin
		tot_buffer = [temporary(tot_buffer), buffer[0:(n_lines-1)]]
	endelse
endif
free_lun, unit
return, tot_buffer
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -