home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga ACS 1997 #2
/
amigaacscoverdisc
/
utilities
/
shareware
/
music
/
gfft-2.03
/
source
/
gfft-2.03-source.lha
/
gopen.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-01-02
|
2KB
|
45 lines
/***************************************************************************
* 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.
* 13-January-1995 CPP (1.19) use <string.h> for ANSI compat
* Comments:
*/
#include <stdio.h>
#include <string.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;
}