PWB Extensions Help (ext.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GetPfileFromName
                                             Up Contents Index Back
─────PWB Extensions─────────────────────────────────────────────────────────
 
  Syntax: PFILE GetPfileFromName( char far *Name, char far *ShortName,
                                  flagType IfNotExist );
 
  Returns: Returns handle of requested file on success, PNULL on
           failure.
 
  See:     DelFile, fChangeFile, FileNameToHandle, FileRead, FileWrite,
           fSetWindowWithFile, pFileToBottom, pFileToTop, RemoveFile,
           Using Files
 
     GetPfileFromName completely sets up access to a file in one step.
     It initializes the file handle and associated data, and reads the
     file into memory, creating the file on disk if necessary.
 
     Argument       Description
 
     <Name>         Full name of the file
     <ShortName>    Base name of the file
     <IfNotExist>   Action when the specified file does not exist, as
                    follows:
 
                    PFN_FAIL      Fail
                    PFN_ASK       Prompt the user to create the file
                    PFN_CREATE    Create the file without prompting
 
     The <Name> string contains the full name of a file. A drive and
     directory can be included. The <ShortName> string contains the base
     name only. Either string can be an empty string or NULL to indicate
     that the argument should be ignored.
 
     GetPfileFromName looks for a filename that matches either <Name> or
     <ShortName> in the list of open files. If the file is already open,
     GetPfileFromName returns a handle for the file. If the file is not
     open, it optionally creates the file, depending on the value of
     <IfNotExist>.
 
     The names can be pseudofile names. A pseudofile name has the form:
 
          <ShortName>Window Title
 
     The short form of the pseudofile name includes the angle brackets.
     The title part of the pseudofile name (the part after the closing
     angle bracket) is optional.
     See: Pseudofile Naming Convention
 
     GetPfileFromName returns PNULL when it fails to open the file,
     according to the value of the <IfNotExist> argument, as follows:
 
     Value         Failure When:
 
     PFN_FAIL      File does not exist.
     PFN_ASK       File does not exist and the user chooses No in the
                   prompt to create it, or file could not be created.
     PFN_CREATE    File does not exist and could not be created.
                                    -♦-