fileio.c

Sapphire/src/emc/fileio.c · 1003 B

From the archive sapphire_0.3.zip

Download the archive   « Back to the archive contents

/*
 * Copyright (C) 1995-1997 Christopher D. Granz
 *
 * This header may not be removed.
 *
 * Refer to the file "License" included in this package for further
 * information and before using any of the following.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <errno.h>

#include "emc.h"


/*
 * Globals
 */
char *                                                      pCOFilename;
long                                                       lCurrentLine;


/*
 * Functions
 */
FILE *open_file( char *pFilename, char *pFlags )
{
    FILE *pFile;

    if ( ( pFile = fopen( pFilename, pFlags ) ) == NULL )
        fatal( "%s: %s.", pFilename, strerror( errno ) );

    pCOFilename  = str_dup( pFilename );
    lCurrentLine = 1;

    return ( pFile );
}


void close_file( FILE *pFile )
{
    if ( fclose( pFile ) != 0 )
        error( "%s: %s.", pCOFilename, strerror( errno ) );

    str_free( pCOFilename );
}


/*
 * End of fileio.c
 */

Site Stats

Snippets: 1791
Codebases: 571