general/misc/
file_open.pro
Procedure FILE_OPEN,type,name Purpose: wrapper for OPENW, OPENU, OPENR, FILE_MKDIR type must be one of: 'w', 'u', 'r', 'd' (write, update, read, directory) This procedure performs the functions of creating/opening files and creating directories. It has several useful features which the regular procedures do not have: 1) Non-existant directories are created automatically (with optional mode setting) 2) If a non-existant file is opened for update, it is created with OPENW instead of producing an error. 3) Files (or directories) can be tested to see if they can be created before actually opening (or creating) them (use the TEST keyword). (The returned structure INFO will have the WRITE element set) Example 1: Creating a file for write access: FILE_OPEN,'w','/dir1/dir2/dir3/file.tmp',unit=u ; Will create the director tree if it does not already exist. Example 2: Creating new directories with defined modes: FILE_OPEN,'d','/dir1/dir2/dir3', dir_mode="777 , All newly created directories will have the given permissions (Octal 777) Example 3: FILE_OPEN,'w','/dir1/dir2/dir3/file.tmp',/test,info=info ;This will test if the file can be created (with given file system permissions) without actually creating the file. The returned info stucture can potentially have info.exists eq to 0 and info.write eq 1 Example 4:
Routines
top source file_open
file_open, type, name, unit=unit, createable=createable, info=info, test_only=test_only, archive_ext=archive_ext, file_mode=file_mode, dir_mode=dir_mode, dlevel=dlevel, verbose=verbose, error_message=error_message
Parameters
- type
- name
Keywords
- unit
- createable
- info
- test_only
- archive_ext
- file_mode
- dir_mode
- dlevel
- verbose
- error_message
File attributes
Modification date: | Thu Feb 13 16:43:49 2014 |
Lines: | 80 |