/*<Header>==============================================================
*
*	FILE MANAGER / "EIN_FL05.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>================================================================
*	int		EIN_remove( char *fullpath )
*
*	【概  要】	ファイルを削除します
*
*	【機  能】	通常の'remove()'と同様に使用できます。
*				int24hハンドラをフックしているので、ドライブにアクセス
*				できなかった場合でもシェルのアラートを出しません。
*
*	【入  力】
*				*fullpath	:	削除するファイル名文字列へのポインタ
*
*	【出  力】
*
*	【関数値】	!= NULL		正常終了(ファイルポインタ)
*				== NULL		異常終了
*
*	【注  意】	
*
*	【参  照】	EIN_fopen();
*
*-----------------------------------------------------------------------
*	V11L10	1994.07.16/Nam
*</Func>==============================================================*/
int		EIN_remove( char *fullpath )
{
	FILE	*fp;

	extern FILE	*EIN_fopen();

	if ( fullpath == NULL){
		return ERROR;
	}
	if ( strlen( fullpath ) < 1 ){
		return ERROR;
	}
	// 仮に開いてファイルの存在を確認
	if ( (fp = EIN_fopen( fullpath, "r" )) == (FILE *)NULL ){
		// ファイルをオープンできなかった
		return ERROR;
	}
	fclose( fp );
	return remove( fullpath );
}

