home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / lib / dllib / openx.doc < prev    next >
Encoding:
Text File  |  1986-10-04  |  1.7 KB  |  44 lines

  1.  
  2.  
  3.         NAME
  4.                 openp -- open a file in the PATH
  5.                 opend -- open a file in an environment variable
  6.                 openg -- opend/openp combination
  7.  
  8.         SYNOPSIS
  9.                 fh = openp(name, mode);
  10.                 fh = opend(name, mode, envar);
  11.                 fh = openg(name, mode, envar);
  12.                 int fh;            file handle returned
  13.                 char *name;        filename
  14.                 int mode;          mode
  15.                 char *envar;       name of environment variable
  16.  
  17.         DESCRIPTION
  18.         These three functions allow the opening of a file in other than just
  19.         the current directory.  All functions will attempt the open in the
  20.         current directory first, and if that fails, will then expand to search:
  21.              openp -- searchs PATH environment variable
  22.              opend -- searches a specified environment variable,
  23.                       with directories specified in the same syntax as for PATH
  24.              openg -- performs an opend() first, and upon failure an openp()
  25.         These functions will return -1 upon failure.  The file MUST
  26.         EXIST in order for a file handle to be returned.  Therefore, these
  27.         functions cannot be used to create new files.
  28.  
  29.         EXAMPLE
  30.  
  31.              int fh;
  32.  
  33.              if((fh = openp("foo.bar", O_READ)) == -1) cant("foo.bar");
  34.              else puts("File is now opened!");
  35.  
  36.              if((fh = opend("stdio.h", O_READ, "INCLUDE")) == -1)
  37.                   cant("stdio.h");
  38.              else puts("stdio.h is open for reading");
  39.  
  40.              /* fopeng works the same as fopend */
  41.  
  42.  
  43.         This function is found in SMDLx.LIB for the Datalight Compiler.
  44.