ファイル関数
[詳解]
#include "file.h"
#include "device.h"
#include "storage.h"
#include "str.h"
#include "tkprintf.h"
#include "fs.h"
#include "dtprintf.h"
[ソースコード]
|
void | init_file (void) |
| 全てのファイルディスクリプタを初期化する
|
|
int | get_diskno (const uchar *path) |
| ファイル名からストレージ番号を調べる [詳解]
|
|
struct st_filesystem * | get_filesystem (const uchar *path) |
| ファイル名からファイルシステムを調べる [詳解]
|
|
int | open_file (const uchar *path, int flags) |
| ファイルを開く [詳解]
|
|
t_ssize | read_file (int fd, void *buf, t_size count) |
| ファイルからデータを読み出す [詳解]
|
|
t_ssize | write_file (int fd, const void *buf, t_size count) |
| ファイルにデータを書き込む [詳解]
|
|
t_ssize | seek_file (int fd, t_ssize offset, int whence) |
| ファイルアクセス位置の設定 [詳解]
|
|
t_size | tell_file (int fd) |
| ファイルアクセス位置の取得 [詳解]
|
|
int | close_file (int fd) |
| ファイルを閉じる [詳解]
|
|
FS_DIR * | opendir_file (const uchar *name) |
| ディレクトリを開く [詳解]
|
|
int | readdir_file (FS_DIR *dir, FS_FILEINFO *finfo) |
| ディレクトリを読み出す [詳解]
|
|
int | closedir_file (FS_DIR *dir) |
| ディレクトリを閉じる [詳解]
|
|
int | stat_file (const uchar *path, FS_FILEINFO *finfo) |
| ファイルステータスを読み出す [詳解]
|
|
int | getfree_file (const uchar *path, unsigned long *sect, void **fso) |
| 論理ドライブの未使用クラスタ数を取得する [詳解]
|
|
int | sync_file (int fd) |
| キャッシュされたデータをフラッシュする [詳解]
|
|
int | unlink_file (const uchar *path) |
| ファイルを消去する [詳解]
|
|
int | mkdir_file (const uchar *path) |
| ディレクトリを作成する [詳解]
|
|
int | rename_file (const uchar *oldpath, const uchar *newpath) |
| ファイル/ディレクトリ名を変更する [詳解]
|
|
uchar * | get_last_filename (uchar *filename, const uchar *fullpath, unsigned int len) |
| ファイルパスからファイル名のみを取得する [詳解]
|
|
uchar * | get_filename_extension (uchar *ext, const uchar *filename, unsigned int len) |
| ファイル拡張子を取得する [詳解]
|
|
char * | size2str (char *str, t_size size) |
|
ファイル関数
GadgetSeed のファイルシステムは FatFs を使用しています。
参考 : http://elm-chan.org/fsw/ff/00index_e.html
- 日付
- 2018.09.15
-
2008.03.20
- 著者
- Takashi SHUDO
file.c に定義があります。
◆ close_file()
◆ closedir_file()
int closedir_file |
( |
FS_DIR * |
dir | ) |
|
ディレクトリを閉じる
- 引数
-
- 戻り値
- エラーコード
file.c の 382 行目に定義があります。
◆ get_diskno()
int get_diskno |
( |
const uchar * |
path | ) |
|
◆ get_filename_extension()
uchar* get_filename_extension |
( |
uchar * |
ext, |
|
|
const uchar * |
filename, |
|
|
unsigned int |
len |
|
) |
| |
◆ get_filesystem()
◆ get_last_filename()
uchar* get_last_filename |
( |
uchar * |
filename, |
|
|
const uchar * |
fullpath, |
|
|
unsigned int |
len |
|
) |
| |
ファイルパスからファイル名のみを取得する
- 引数
-
[out] | filename | ファイル名 |
[in] | fullpath | ファイルパス名 |
[in] | len | 最大ファイル名バイト数 |
- 戻り値
- ファイル名
file.c の 633 行目に定義があります。
参照先 strleng(), strncopy().
◆ getfree_file()
int getfree_file |
( |
const uchar * |
path, |
|
|
unsigned long * |
sect, |
|
|
void ** |
fso |
|
) |
| |
論理ドライブの未使用クラスタ数を取得する
- 引数
-
[in] | path | ファイル(ドライブ)名 |
[out] | sect | |
[out] | fs | |
- 戻り値
- エラーコード
file.c の 437 行目に定義があります。
◆ mkdir_file()
int mkdir_file |
( |
const uchar * |
path | ) |
|
ディレクトリを作成する
- 引数
-
- 戻り値
- エラーコード
file.c の 515 行目に定義があります。
◆ open_file()
int open_file |
( |
const uchar * |
path, |
|
|
int |
flags |
|
) |
| |
ファイルを開く
- 引数
-
- 戻り値
- ファイルディスクリプタ(0:エラー)
file.c の 144 行目に定義があります。
◆ opendir_file()
ディレクトリを開く
- 引数
-
- 戻り値
- ディレクトリ(0:エラー)
file.c の 329 行目に定義があります。
◆ read_file()
t_ssize read_file |
( |
int |
fd, |
|
|
void * |
buf, |
|
|
t_size |
count |
|
) |
| |
ファイルからデータを読み出す
- 引数
-
[in] | int | ファイルディスクリプタ |
[out] | buf | 読み出しデータポインタ |
[in] | count | 読み出しバイト数 |
- 戻り値
- 読み出しバイト数(<0:エラー)
file.c の 188 行目に定義があります。
◆ readdir_file()
ディレクトリを読み出す
- 引数
-
[in] | dir | ディレクトリ |
[out] | info | ファイル情報 |
- 戻り値
- エラーコード
file.c の 356 行目に定義があります。
◆ rename_file()
int rename_file |
( |
const uchar * |
oldpath, |
|
|
const uchar * |
newpath |
|
) |
| |
ファイル/ディレクトリ名を変更する
- 引数
-
[in] | oldpath | 変更されるファイル名 |
[in] | newpath | 変更後のファイル名 |
- 戻り値
- エラーコード
異なるデバイスへの名前変更はできない
file.c の 573 行目に定義があります。
◆ seek_file()
t_ssize seek_file |
( |
int |
fd, |
|
|
t_ssize |
offset, |
|
|
int |
whence |
|
) |
| |
ファイルアクセス位置の設定
- 引数
-
[in] | fd | ファイルディスクリプタ |
[in] | offset | 移動バイト数 |
[in] | whence | 移動基準位置 |
- 戻り値
- 先頭からのオフセット位置バイト数
file.c の 244 行目に定義があります。
◆ stat_file()
ファイルステータスを読み出す
- 引数
-
[in] | path | ファイル(ディレクトリ)名 |
[out] | info | ファイル情報構造体ポインタ |
- 戻り値
- エラーコード
file.c の 409 行目に定義があります。
◆ sync_file()
キャッシュされたデータをフラッシュする
- 引数
-
- 戻り値
- エラーコード
file.c の 463 行目に定義があります。
◆ tell_file()
t_size tell_file |
( |
int |
fd | ) |
|
ファイルアクセス位置の取得
- 引数
-
- 戻り値
- 先頭からのオフセット位置バイト数
file.c の 270 行目に定義があります。
◆ unlink_file()
int unlink_file |
( |
const uchar * |
path | ) |
|
ファイルを消去する
- 引数
-
- 戻り値
- エラーコード
file.c の 489 行目に定義があります。
◆ write_file()
t_ssize write_file |
( |
int |
fd, |
|
|
const void * |
buf, |
|
|
t_size |
count |
|
) |
| |
ファイルにデータを書き込む
- 引数
-
[in] | fd | ファイルディスクリプタ |
[in] | buf | 書き込みデータポインタ |
[in] | count | 書き込みバイト数 |
- 戻り値
- 書き込みバイト数(<0:エラー)
file.c の 216 行目に定義があります。