home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- * Copyright (C) 1994 Charles P. Peterson *
- * 4007 Enchanted Sun, San Antonio, Texas 78244-1254 *
- * Email: Charles_P_Peterson@fcircus.sat.tx.us *
- * *
- * This is free software with NO WARRANTY. *
- * See gfft.c, or run program itself, for details. *
- * Support is available for a fee. *
- ***************************************************************************
- *
- * Program: gfft--General FFT analysis
- * File: gopen.c
- * Purpose: Open a file (using provided path list)
- * Author: Charles Peterson (CPP)
- * History: 13-September-1993 CPP; Created.
- * Comments:
- */
-
- #include <stdio.h>
- #include <strings.h>
- #include "gfft.h"
-
- void *gopen (char *path_list[], char *filename, char *mode)
- {
- FILE *file = NULL;
- char full_filename [MAX_PATH];
- int path_index = 0;
-
- while (!file)
- {
- if (!path_list[path_index]) break;
- if (strlen (path_list[path_index]) + strlen (filename) + 1 >
- MAX_PATH)
- {
- error_message (FILENAME_TOO_LONG);
- }
- strcpy (full_filename, path_list[path_index]);
- strcat (full_filename, filename);
- file = fopen (full_filename, mode);
- path_index++;
- }
- return file;
- }
-