FileExist.c

Go to the documentation of this file.
00001 /*-----------------------------------------------------------------------------------*/
00002 /* INRIA 2005 */
00003 /* Allan CORNET */
00004 /*-----------------------------------------------------------------------------------*/ 
00005 #ifdef _MSC_VER
00006 #include <Windows.h>
00007 #else
00008 #include <stdio.h>
00009 #endif
00010 #include "FileExist.h"
00011 /*-----------------------------------------------------------------------------------*/ 
00012 BOOL FileExist(char *filename)
00013 {
00014         BOOL retour=FALSE;      
00015 
00016         #ifdef _MSC_VER
00017                 WIN32_FIND_DATA FindFileData;
00018                 HANDLE handle = FindFirstFile (filename, &FindFileData);
00019                 if (handle != INVALID_HANDLE_VALUE)
00020                 {
00021                         FindClose (handle);
00022                         retour=TRUE;
00023                 }
00024                 else retour=FALSE;
00025         #else
00026         FILE* tmpFile; 
00027         if( (tmpFile=fopen(filename,"r")) == FALSE ) 
00028         { 
00029                 retour=FALSE;
00030         } 
00031         else 
00032         { 
00033                 fclose(tmpFile); 
00034                 retour=TRUE;
00035         } 
00036         #endif
00037 
00038         return retour;
00039 }
00040 /*-----------------------------------------------------------------------------------*/ 

Generated on Sun Mar 4 15:03:49 2007 for Scilab [trunk] by  doxygen 1.5.1