** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: filefuncs.cpp,v 1.2 2000/06/19 19:04:05 kevin Exp $
+** $Id: filefuncs.cpp,v 1.3 2000/06/22 10:17:28 kevin Exp $
**
** Revision 1.1.1.1 2000/04/28 13:02:44 kevin
** Initial CVS import for first public release
/* NAME
- * file_exists Checks if a specified disk fie exists
+ * fileExists Checks if a specified disk fie exists
*
* SYNOPSIS
- * exist = file_exists (fname)
+ * exist = fileExists (fname)
* bool exist TRUE if specified file exists
*/
bool
-file_exists (const char *fname)
+fileExists (const char *fname)
{
FILE *fp;
bool exist;
return (exist);
}
-/*-----------------------------------------------------------------------------
- *
- * FUNCTION IDENTIFICATION
- *
- * Name: sys_fopen Open a file for user
- * Date: 12-17-84
- * Programmer: Kevin Rosenberg
- *
- * SYNOPSIS
- * fp = sys_fopen (filename, mode, progname)
- * FILE *fp Standard pointer to 'C' file
- * char *filename Name of file to open
- * If user enters a new name, it goes here
- * char *mode Mode to open file (std. 'C')
- * char *progname Name of program calling this routine
- *
- * DESCRIPTION
- * This routine opens a file using the standard C fopen() routine. If
- * the file is not found, the user is given to option to:
- *
- * 1 - Retry opening file with same name
- * 2 - Enter new file name
- * 3 - Abort and return to DOS
- *
- * CAUTIONS
- * If the the requested file is not found, the name of the file given
- * entered at keyboard will be returned in filename. So, make sure there
- * is room for a maximum length filename (MAXFULLNAME)
- *
- *---------------------------------------------------------------------------*/
-
-FILE *
-sys_fopen (const char *filename, const char *mode, const char *progname)
-{
- FILE *fp;
- char fname[256]; /* name used for call to fopen() */
- char c; /* keyboard response */
-
- strncpy (fname, filename, sizeof(fname));
-
- do {
- if ((fp = fopen (fname, mode)) == NULL) {
- cerr << endl;
- cerr << "Can't open file " << fname << " [" << progname << "]" << endl;
- cerr << "Enter: <R> - Retry | <N> - New name | <A> - Abort program --> ";
- c = cio_kb_waitc ("RrNnAa", TRUE);
- c = tolower(c);
- cerr << c << endl;
-
- if (c == 'r') // Retry -- Nothing to do here
- ;
- else if (c == 'a') // Abort -- Exit to OS
- exit (1);
- else if (c == 'n') { // New name - get from console
- cerr << "Enter new file name -- ";
- fgets (fname, sizeof(fname), stdin);
- str_wrm_tail (fname);
- cerr << endl;
- }
- }
- } while (fp == NULL);
-
- return (fp);
-}