std-fcloseall


Synopsis

(std-fcloseall)

Description

std-fcloseall closes all currently opened files which were opened wih std-fopen using the global list *FOPEN*. It should be used in the error handler in any function opening files.

This is workaround for the common lisp macro with-open-file.

Note: It's like binio-fcloseall but not the same! binio-fcloseall handles a not accessible list of currently opend binary files, std-fcloseall the global accessible list *FOPEN*.

Example

(defun myfunc (/ *error* f)
  (defun *error* (s)
    (princ s)
    (std-fcloseall))
(if (setq f (std-fopen "test" "w"))
  (progn

;...

    (std-fclose f)
  )
)

Arguments

None.

Return Value

not defined.

Side Effects

It closes all currently opened files. On success it sets the global *FOPEN* list to nil.

No error is thrown if any file in *FOPEN* was already closed, but an error may be thrown by close.

Module

(std-require 'STDFILE)

Defined in STDFILE