如何在Linux中以编程方式获取给定相对路径的绝对路径?
16lz
2021-01-22
How to get the absolute path for a given relative path programmatically in Linux?
如何在Linux中以编程方式获取给定相对路径的绝对路径?
Incase of Windows we have the _fullpath() API. In other words, I mean what is analogous API to _fullpath of Windows in Linux?
在Windows的情况下,我们有_fullpath()API。换句话说,我的意思是什么是Linux中_fullpath的类似API?
7 个解决方案
#1
14
As Paul mentioned, use realpath()
. Please note though, that since many file systems in Linux support hard links, any given directory can have a number of different absolute paths.
正如Paul所说,使用realpath()。但请注意,由于Linux中的许多文件系统都支持硬链接,因此任何给定目录都可以有许多不同的绝对路径。
更多相关文章
- 确定shell程序中的相对路径或绝对路径
- 嵌入式Linux文件系统及其存储机制分析
- 为什么Linux不需要磁盘碎片整理?——借以复习文件系统方面的知识
- Linux学习之文件系统权限及表示
- linux 文件系统的管理 (硬盘) 工作原理
- Linux学习第二天-文件系统和简单文件操作命令
- TQ210 —— 嵌入式Linux根文件系统的设计与实现
- Inotify: 高效、实时的Linux文件系统事件监控框架
- linux文件系统内容