| iMatix home page
| << | < | > | >>
SMT Logo SMT
Version 2.81

 

lazy_open

#include "smtlib.h"
int
lazy_open (char *path, int flags)

Synopsis

Calls the standard open() function without blocking. Returns a file handle when the call succeeds, else returns -1 and sets errno to the cause of the error. The file is always opened in binary mode, and you must process control characters yourself. If the call would block, returns -1, sets errno to EAGAIN, and calls recycle module() to re-execute the current dialog module automatically. You can override this behavious by calling recycle module (FALSE) after the return. Sets the global variable "io_completed" to TRUE if the i/o access completed, with or without an error.

Examples

    handle_input  = lazy_open (filename, O_RDONLY);
    handle_output = lazy_open (filename, O_WRONLY | O_CREAT | O_TRUNC);
    handle_append = lazy_open (filename, O_WRONLY | O_CREAT | O_APPEND);
    if (io_completed && handle < 0)
        have error on file

Source Code - (smtlib.c)

{
    int rc;

#if (defined (SMT_TRACE))
    trace ("lazy_open: path=%s", path);
#endif
    rc = open (path, flags | O_NONBLOCK | O_BINARY, S_IREAD | S_IWRITE);
    set_io_completed (rc);
    return (rc);
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation