;+ ; ; @file_comments ; Write a text file from a string array. ; ; @categories ; ; @param FILE {in}{required}{type=string} ; = text file name. ; ; @param S {in}{required}{type=string or array} ; = string array. ; ; @keyword ERROR ; =err error flag: 0=ok, 1=invalid string array. ; ; @history ; R. Sterner, 20 Mar, 1990 ; R. Sterner, 4 Nov, 1992 --- allowed scalar strings. ; ; Copyright (C) 1990, Johns Hopkins University/Applied Physics Laboratory ; This software may be used, copied, or redistributed as long as it is not ; sold and this copyright notice is reproduced on each copy made. This ; routine is provided as is without any express or implied warranties ; whatsoever. Other limitations apply as described in the file disclaimer.txt. ; ; @version ; $Id$ ; ;- PRO putfile, file, s, ERROR=err, HELP=hlp ; compile_opt idl2, strictarrsubs ; if (n_params(0) lt 1) or keyword_set(hlp) then begin print,' Write a text file from a string array.' print,' putfile, f, s' print,' f = text file name. in' print,' s = string array. in' print,' Keywords:' print,' ERROR=err error flag: 0=ok, 1=invalid string array.' return endif ; if lmgr(/demo) then begin print, 'you are in Demo mode. It is impossible to write a file' return endif ; if size(s, /type) ne 7 then begin print,' Error in putfile: argument must be a string array.' err = 1 return endif get_lun, lun openw, lun, file for i = 0, n_elements(s)-1 do begin t = s[i] if t eq '' then t = ' ' printf, lun, t endfor close, lun free_lun, lun err = 0 return end