1
/* $Id: file_access.h 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
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.
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
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#ifndef __PJ_FILE_ACCESS_H__
21
#define __PJ_FILE_ACCESS_H__
25
* @brief File manipulation and access.
32
* @defgroup PJ_FILE_ACCESS File Access
39
* This structure describes file information, to be obtained by
40
* calling #pj_file_getstat(). The time information in this structure
43
typedef struct pj_file_stat
45
pj_off_t size; /**< Total file size. */
46
pj_time_val atime; /**< Time of last access. */
47
pj_time_val mtime; /**< Time of last modification. */
48
pj_time_val ctime; /**< Time of last creation. */
53
* Returns non-zero if the specified file exists.
55
* @param filename The file name.
57
* @return Non-zero if the file exists.
59
PJ_DECL(pj_bool_t) pj_file_exists(const char *filename);
62
* Returns the size of the file.
64
* @param filename The file name.
66
* @return The file size in bytes or -1 on error.
68
PJ_DECL(pj_off_t) pj_file_size(const char *filename);
73
* @param filename The filename.
75
* @return PJ_SUCCESS on success or the appropriate error code.
77
PJ_DECL(pj_status_t) pj_file_delete(const char *filename);
80
* Move a \c oldname to \c newname. If \c newname already exists,
81
* it will be overwritten.
83
* @param oldname The file to rename.
84
* @param newname New filename to assign.
86
* @return PJ_SUCCESS on success or the appropriate error code.
88
PJ_DECL(pj_status_t) pj_file_move( const char *oldname,
93
* Return information about the specified file. The time information in
94
* the \c stat structure will be in local time.
96
* @param filename The filename.
97
* @param stat Pointer to variable to receive file information.
99
* @return PJ_SUCCESS on success or the appropriate error code.
101
PJ_DECL(pj_status_t) pj_file_getstat(const char *filename, pj_file_stat *stat);
109
#endif /* __PJ_FILE_ACCESS_H__ */