doc
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
src
std
c_file.h
Go to the documentation of this file.
1
/*
2
* cynapses libc functions
3
*
4
* Copyright (c) 2008 by Andreas Schneider <mail@cynapses.org>
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
*
20
* vim: ft=c.doxygen ts=2 sw=2 et cindent
21
*/
22
23
/**
24
* @file c_file.h
25
*
26
* @brief Interface of the cynapses libc file function
27
*
28
* @defgroup cynFileInternals cynapses libc file functions
29
* @ingroup cynLibraryAPI
30
*
31
* @{
32
*/
33
34
#ifndef _C_FILE_H
35
#define _C_FILE_H
36
37
#include <sys/types.h>
38
39
#ifndef BUFFER_SIZE
40
#define BUFFER_SIZE (16 * 1024)
41
#endif
42
43
/**
44
* @brief Check if a path is a regular file or a link.
45
*
46
* @param path The path to check.
47
*
48
* @return 1 if the path is a file, 0 if the path doesn't exist, is a
49
* something else or can't be accessed.
50
*/
51
int
c_isfile
(
const
char
*
path
);
52
53
/**
54
* @brief copy a file from source to destination.
55
*
56
* @param src Path to the source file
57
* @param dst Path to the destination file
58
* @param mode File creation mode of the destination. If mode is 0 then the
59
* mode from the source will be used.
60
*
61
* @return 0 on success, less then 0 on error with errno set.
62
* EISDIR if src or dst is a file.
63
*/
64
int
c_copy
(
const
char
*src,
const
char
*dst, mode_t
mode
);
65
66
/**
67
* @brief Compare the content of two files byte by byte.
68
* @param f1 Path of file 1
69
* @param f2 Path of file 2
70
*
71
* @return 0 if the files differ, 1 if the files are equal or -1 on
72
* error with errno set.
73
*/
74
int
c_compare_file
(
const
char
*f1,
const
char
*f2 );
75
76
/**
77
* @brief move a file from source to destination.
78
*
79
* @param src Path to the source file
80
* @param dst Path to the destination file
81
*
82
* @return 0 on success, less than 0 on error with errno set.
83
*/
84
int
c_rename
(
const
char
*src,
const
char
*dst );
85
86
/**
87
* }@
88
*/
89
#endif
/* _C_FILE_H */
90
Generated by
1.8.1