MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
io.h
1/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2miniob is licensed under Mulan PSL v2.
3You can use this software according to the terms and conditions of the Mulan PSL v2.
4You may obtain a copy of Mulan PSL v2 at:
5 http://license.coscl.org.cn/MulanPSL2
6THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9See the Mulan PSL v2 for more details. */
10
11//
12// Created by Longda on 2010
13//
14
15#pragma once
16
17#include <vector>
18
19#include "common/defs.h"
20#include "common/lang/string.h"
21#include "common/lang/vector.h"
22
23namespace common {
24
30int readFromFile(const string &fileName, char *&data, size_t &fileSize);
31
32int writeToFile(const string &fileName, const char *data, uint32_t dataSize, const char *openMode);
33
37int getFileLines(const string &fileName, uint64_t &lineNum);
38
49int getFileList(vector<string> &fileList, const string &path, const string &pattern, bool recursive);
50int getFileNum(uint64_t &fileNum, const string &path, const string &pattern, bool recursive);
51int getDirList(vector<string> &dirList, const string &path, const string &pattern);
52
53int touch(const string &fileName);
54
58int getFileSize(const char *filePath, uint64_t &fileLen);
59
68int writen(int fd, const void *buf, int size);
69
78int readn(int fd, void *buf, int size);
79
80} // namespace common