file_handling.h

00001 
00002 /*----------------------------------------------------------------------------
00003  *                                  E.S.O.
00004  *----------------------------------------------------------------------------
00005  * File name    :   file_handling.h
00006  * Author       :   Nicolas Devillard
00007  * Created on   :   Mar 12, 1995
00008  * Hardware     :   Sun Sparc 20
00009  * Software     :   ANSI C under Solaris Unix
00010  *                  Part of ECLIPSE library for Adonis
00011  * Description  :   file handling routines
00012  *--------------------------------------------------------------------------*/
00013 
00014 /*
00015 
00016     $Id: file_handling.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $
00017     $Author: amodigli $
00018     $Date: 2003/09/03 12:50:47 $
00019     $Revision: 1.1 $
00020 
00021  */
00022 
00023 
00024 #ifndef _FILE_HANDLING_H_
00025 #define _FILE_HANDLING_H_
00026 
00027 
00028 /*----------------------------------------------------------------------------
00029  *                              Includes
00030  *--------------------------------------------------------------------------*/
00031 
00032 
00033 #include <stdio.h>
00034 #include <stdlib.h>
00035 #include <string.h>
00036 #include <sys/types.h>
00037 #include <sys/stat.h>
00038 
00039 #include "memory.h"
00040 
00041 
00042 /*----------------------------------------------------------------------------
00043                         Function ANSI C prototypes
00044  ---------------------------------------------------------------------------*/
00045 
00046 /*---------------------------------------------------------------------------
00047    Function :   file_exists()
00048    In       :   filename
00049    Out      :   int 1 if file exists, 0 otherwise
00050    Job      :   find out if a given file name corresponds to a valid file
00051    Notice   :
00052  ---------------------------------------------------------------------------*/
00053 
00054 int file_exists(char * filename);
00055 
00056 
00057 /*---------------------------------------------------------------------------
00058  * Function :   filesize()
00059  * In       :   filename
00060  * Out      :   size of the file in bytes
00061  * Job      :   strongly non portable. Only on Unix systems!
00062  * Notice   :   Looks strange, but there is no portable way to answer
00063  *              the question: how many bytes can I read from this file?
00064  *--------------------------------------------------------------------------*/
00065 
00066 size_t
00067 filesize(char *filename) ;
00068 
00069 
00070 /*---------------------------------------------------------------------------
00071  * Function :   copy_file()
00072  * In       :   filename dest, filename source
00073  * Out      :   error code 0 if ok, 1 if something happened
00074  * Job      :   copy a file, overwrite if already exists
00075  * Notice   :
00076  *--------------------------------------------------------------------------*/
00077 
00078 int copy_file(char *src, char *dest) ;
00079 
00080 
00081 /*---------------------------------------------------------------------------
00082  * Function :   copy_file_n_bytes()
00083  * In       :   pointers to 2 opened files, src and dest, number of bytes
00084  *              to copy from src to dest.
00085  * Out      :   int 0 if Ok, 1 if error.
00086  * Job      :   Copy n bytes from file src to file dest
00087  * Notice   :
00088  *--------------------------------------------------------------------------*/
00089 
00090 int
00091 copy_file_n_bytes(
00092     FILE    *   dest, 
00093     FILE    *   src,
00094     ulong32     nbytes
00095 ) ;
00096 
00097 #endif
00098 /*--------------------------------------------------------------------------*/

Generated on Wed Oct 26 13:08:52 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001