Skip to content
Snippets Groups Projects
Commit 1400f577 authored by rswindell's avatar rswindell
Browse files

Created ftouch() function.

Updated nopen() and fnopen() prototypes to take const char* for filename.
parent 50a0c1c7
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,7 @@
/* number of times if the attempted file is already open or denying access */
/* for some other reason. All files are opened in BINARY mode. */
/****************************************************************************/
int nopen(char *str, int access)
int nopen(const char* str, int access)
{
int file,share,count=0;
......@@ -64,7 +64,7 @@ int nopen(char *str, int access)
/* This function performs an nopen, but returns a file stream with a buffer */
/* allocated. */
/****************************************************************************/
FILE* fnopen(int *fd, char *str, int access)
FILE* fnopen(int* fd, const char* str, int access)
{
char mode[128];
int file;
......@@ -100,3 +100,15 @@ FILE* fnopen(int *fd, char *str, int access)
setvbuf(stream,NULL,_IOFBF,FNOPEN_BUF_SIZE);
return(stream);
}
BOOL ftouch(const char* fname)
{
int file;
file=nopen(fname,O_WRONLY|O_CREAT);
if(file<0)
return(FALSE);
close(file);
return(TRUE);
}
......@@ -937,8 +937,9 @@ int pstrcmp(char **str1, char **str2); /* Compares pointers to pointers */
int strsame(char *str1, char *str2); /* Compares number of same chars */
/* nopen.c */
int nopen(char *str, int access);
FILE * fnopen(int *file, char *str, int access);
int nopen(const char* str, int access);
FILE * fnopen(int* file, const char* str, int access);
BOOL ftouch(const char* fname);
/* load_cfg.c */
BOOL md(char *path);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment