X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsupport%2Ffilefuncs.cpp;h=ab26634563b5e336a97b60ed8779d9643addf32f;hp=511251d3261f45bb45c1a7793498e988fb8b1870;hb=2d39e823ba389fc68e5317c422b55be006094252;hpb=a95e41ac40cd2f3a4401d921618604cf33f2a904 diff --git a/libctsupport/filefuncs.cpp b/libctsupport/filefuncs.cpp index 511251d..ab26634 100644 --- a/libctsupport/filefuncs.cpp +++ b/libctsupport/filefuncs.cpp @@ -2,7 +2,7 @@ ** 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 @@ -38,15 +38,15 @@ fileBasename (const char* const filename) /* 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; @@ -63,67 +63,3 @@ file_exists (const char *fname) 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: - Retry | - New name | - 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); -}