Subversion Repositories SvarDOS

Rev

Rev 269 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 269 Rev 614
1
/*
1
/*
2
 * fileexists checks whether a file exists or not.
2
 * fileexists checks whether a file exists or not.
3
 * returns 0 if file not found, non-zero otherwise.
3
 * returns 0 if file not found, non-zero otherwise.
4
 */
4
 */
5
 
5
 
6
#include <stdio.h>
6
#include <stdio.h>
7
#include "fileexst.h"
7
#include "fileexst.h"
8
 
8
 
9
int fileexists(const char *filename) {
9
int fileexists(const char *filename) {
10
  FILE *fd;
10
  FILE *fd;
11
  fd = fopen(filename, "rb");
11
  fd = fopen(filename, "rb");
12
  if (fd == NULL) return(0); /* file does not exists */
12
  if (fd == NULL) return(0); /* file does not exists */
13
  fclose(fd);
13
  fclose(fd);
14
  return(1);
14
  return(1);
15
}
15
}
16
 
16