The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
Functions
OpenFile.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SysDefs.h"
#include "port.h"

Go to the source code of this file.

Functions

FILE * blOpenFile (char *filename, char *envvar, char *mode, BOOL *noenv)
 

Detailed Description

Version
V1.23
Date
07.07.14
Author
Dr. Andrew C. R. Martin
Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT.
andre.nosp@m.w@bi.nosp@m.oinf..nosp@m.org..nosp@m.uk andre.nosp@m.w.ma.nosp@m.rtin@.nosp@m.ucl..nosp@m.ac.uk

This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.

The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.

The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.

Description:

Usage:

Revision History:

Definition in file OpenFile.c.

Function Documentation

FILE* blOpenFile ( char *  filename,
char *  envvar,
char *  mode,
BOOL noenv 
)
Parameters
[in]*filenameFilename to be opened
[in]*envvarUnix/MS-DOS environment variable Other OS assign name (with :)
[in]*modeMode in which to open file (r, w, etc)
[out]*noenvSet to TRUE under Unix/MS-DOS if the reason for failure was that the environment variable was not set.
Returns
File pointer or NULL on failure

Attempts to open a filename as specified. Returns a file pointer. If this fails:

Under UNIX/MS-DOS: gets the contents of the envvar environment variable and prepends that to the filename and tries again. If envvar was not set, noenv is set to TRUE and the routine returns a NULL pointer.

Under other OSs: prepends the envvar string onto the filename and tries to open the file again.

Returns the pointer returned by the open() command after all this.

  • 22.09.94 Original By: ACRM
  • 11.09.94 Puts a : in for the assign type.
  • 24.11.94 Added unix define. Checks for trailing / in environment variable
  • 08.03.95 Corrected basename to filename in non-unix version
  • 09.03.95 Checks that filename is not a NULL or blank string
  • 28.07.05 Added conditionals for Mac OS/X: __MACH and APPLE
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 146 of file OpenFile.c.