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中的许多文件系统都支持硬链接,因此任何给定目录都可以有许多不同的绝对路径。

更多相关文章

  1. 确定shell程序中的相对路径或绝对路径
  2. 嵌入式Linux文件系统及其存储机制分析
  3. 为什么Linux不需要磁盘碎片整理?——借以复习文件系统方面的知识
  4. Linux学习之文件系统权限及表示
  5. linux 文件系统的管理 (硬盘) 工作原理
  6. Linux学习第二天-文件系统和简单文件操作命令
  7. TQ210 —— 嵌入式Linux根文件系统的设计与实现
  8. Inotify: 高效、实时的Linux文件系统事件监控框架
  9. linux文件系统内容

随机推荐

  1. Android摄像头照相机技术-android学习之
  2. Android XMl文件中tools前缀
  3. android Textview过长时显示省略号
  4. Android程序反编译的方法[已更新]
  5. Android 内存管理机制
  6. Android API课程1: Application Fundament
  7. Android优秀开源项目收集
  8. android SQLite 使用实例
  9. Android 基本空间划分
  10. android访问服务器端上传及服务器端接收