/*<Header>==============================================================
*
*	FILE MANAGER / "EIN_FL04.C"
*
*		[ EIN(tm) project : ファイル操作補助関数群 ]
*
*	COPYRIGHT  Nam  1994, All rights reserved.
*
*-----------------------------------------------------------------------
*	V1.0L01α	94.07.07/Nam	プロトタイプ
*</Header>==============================================================*/
#include	<stdio.h>
#include 	<stdlib.h>
#include 	<string.h>
#include	<snd.h>
#include	<winb.h>
#include	<te.h>
#include	<fntb.h>
#include	<gui.h>

#define	EIN_FILE
#include	"..\eintm.h"

#ifndef NOERR
#define	NOERR	(0)
#endif
#ifndef ERROR
#define	ERROR	(1)
#endif

/* from EIN_ASM1.ASM */
extern void		EIN_setVector( unsigned long * );
extern void		EIN_resetVector( unsigned long * );

/*<Func>================================================================
*	FILE	*EIN_fopen( char *fullpath, char *mode )
*
*	【概  要】	ファイルをオープンしてファイルハンドルを返します。
*
*	【機  能】	通常の'fopen()'と同様に使用できます。
*				int24hハンドラをフックしているので、ドライブにアクセス
*				できなかった場合でもシェルのアラートを出しません。
*
*	【入  力】
*				*fullpath	:	オープンするファイル名文字列へのポインタ
*				*mode		:	モード文字列へのポインタ
*
*	【出  力】
*
*	【関数値】	!= NULL		正常終了(ファイルポインタ)
*				== NULL		異常終了
*
*	【注  意】	
*
*	【参  照】	
*
*-----------------------------------------------------------------------
*	V11L10	1994.07.07/Nam
*</Func>==============================================================*/
FILE	*EIN_fopen( char *fullpath, char *mode )
{
	unsigned long	vect[3];	/* int24hハンドラの退避用 */
	FILE	*fp;

	if ( fullpath == NULL){
		return NULL;
	}
	if ( strlen( fullpath ) < 1 ){
		return NULL;
	}
	EIN_setVector( vect );		/* int24hをフック */
	fp = fopen( fullpath, mode );
	EIN_resetVector( vect );	/* int24hハンドラを復帰 */

	return fp;
}

