🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ast::posix 命名空间参考

类型定义

using stat = struct ::_stat
 

函数

A_ALWAYS_INLINE int fileno (FILE *file)
 
AST_UTIL_API int rmdir (const char *path)
 
A_ALWAYS_INLINE bool isdir (const stat &st)
 
A_ALWAYS_INLINE int isatty (int fd)
 
A_ALWAYS_INLINE int fstat (int fd, stat *buf)
 
AST_UTIL_API int chdir (const char *path)
 
AST_UTIL_API char * getcwd (char *buf, size_t size)
 
A_ALWAYS_INLINE std::string getcwd ()
 

变量

constexpr size_t kMaxPath = 255
 

详细描述

posix 函数

该命名空间包含了可移植操作系统接口(posix)所定义的函数, 并屏蔽了不同操作系统之间的差异。

函数说明

◆ chdir()

AST_UTIL_API int ast::posix::chdir ( const char * path)

改变当前工作目录

参数
path目录路径
返回
如果成功则返回0,否则返回-1

◆ fileno()

A_ALWAYS_INLINE int ast::posix::fileno ( FILE * file)

获取文件流的文件描述符

参数
file文件流指针
返回
文件描述符

◆ fstat()

A_ALWAYS_INLINE int ast::posix::fstat ( int fd,
stat * buf )

获取文件状态

参数
fd文件描述符
buf指向stat结构体的指针
返回
如果成功则返回0,否则返回-1

◆ getcwd() [1/2]

A_ALWAYS_INLINE std::string ast::posix::getcwd ( )

获取当前工作目录

返回
当前工作目录的路径

◆ getcwd() [2/2]

AST_UTIL_API char * ast::posix::getcwd ( char * buf,
size_t size )

获取当前工作目录

参数
buf指向字符数组的指针,用于存储当前工作目录的路径
sizebuf数组的大小
返回
如果成功则返回buf,否则返回nullptr

◆ isatty()

A_ALWAYS_INLINE int ast::posix::isatty ( int fd)

判断文件描述符是否为终端

参数
fd文件描述符
返回
如果是终端则返回非0值,否则返回0

◆ isdir()

A_ALWAYS_INLINE bool ast::posix::isdir ( const stat & st)

检查文件状态是否为目录

参数
st文件状态结构体
返回
如果是目录则返回true,否则返回false

◆ rmdir()

AST_UTIL_API int ast::posix::rmdir ( const char * path)

删除目录

参数
path目录路径
返回
如果成功则返回0,否则返回-1