SDDSlib
Loading...
Searching...
No Matches
SDDS
mdblib
fexists.c
Go to the documentation of this file.
1
/**
2
* @file fexists.c
3
* @brief Implementation of file existence checking function.
4
*
5
* @copyright
6
* - (c) 2002 The University of Chicago, as Operator of Argonne National Laboratory.
7
* - (c) 2002 The Regents of the University of California, as Operator of Los Alamos National Laboratory.
8
*
9
* @license
10
* This file is distributed under the terms of the Software License Agreement
11
* found in the file LICENSE included with this distribution.
12
*
13
* @author C. Saunders, R. Soliday
14
*/
15
16
#include "mdb.h"
17
18
/**
19
* @brief Checks if a file exists.
20
*
21
* This function attempts to open the specified file in read mode. If the file is successfully opened,
22
* it indicates that the file exists and the function returns 1. Otherwise, it returns 0.
23
*
24
* @param filename The name of the file to check for existence.
25
* @return Returns 1 if the file exists, otherwise returns 0.
26
*/
27
long
fexists
(
const
char
*filename) {
28
FILE *fp;
29
30
if
((fp = fopen(filename, FOPEN_READ_MODE))) {
31
fclose(fp);
32
return
(1);
33
}
34
return
(0);
35
}
fexists
long fexists(const char *filename)
Checks if a file exists.
Definition
fexists.c:27
Generated by
1.12.0