Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

timesFile.c

Go to the documentation of this file.
00001 /*
00002  * timesFile.c
00003  *
00004  * Copyright (c) 2003 The University of Utah and the Flux Group.
00005  * All rights reserved.
00006  *
00007  * This file is licensed under the terms of the GNU Public License.  
00008  * See the file "license.terms" for restrictions on redistribution 
00009  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010  */
00011 
00012 /**
00013  * @file timesFile.c
00014  *
00015  * Implementations of the functions in timesFile.h.
00016  */
00017 
00018 #include "config.h"
00019 
00020 #include <stdio.h>
00021 #include <string.h>
00022 #include <assert_pp.h>
00023 
00024 #include <timesFile.h>
00025 
00026 int tfMakeTimesFile(const char *name, const float values[])
00027 {
00028     int retval = 0;
00029     FILE *file;
00030 
00031     require(name != NULL);
00032     require(strlen(name) > 0);
00033     require(values != NULL);
00034 
00035     if( (file = fopen(name, "w")) != NULL )
00036     {
00037         int lpc;
00038 
00039         for( lpc = 0; values[lpc] != TIMES_FILE_TERMINATOR; lpc++ )
00040         {
00041             require(values[lpc] >= 0.0);
00042             require(values[lpc] <= 150.0);
00043             
00044             fprintf(file, "%f\n", values[lpc]);
00045         }
00046         fclose(file);
00047 
00048         retval = 1;
00049     }
00050     return( retval );
00051 }

Generated on Fri Oct 22 07:50:25 2004 for CPU Broker by  doxygen 1.3.9.1