是否有C的跨平台文件IO/路径util库? [英] Is there any cross platform file IO / path util library for C?

查看:93
本文介绍了是否有C的跨平台文件IO/路径util库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一些C库实现了与平台无关的路径操作版本?

Is there some C library that implements platform independent version of path operations?

想到一些例子:

  • 从相对路径获取绝对路径(不需要文件存在)
  • 确保目录存在.
  • 创建文件(如果不存在)以及给定路径中缺少的任何目录.
  • 连接路径.
  • 获取目录路径的一部分.
  • 获取路径的文件名部分.
  • 还有很多....

当然有这些平台的特定版本,但是它们几乎没有做过完全相同的事情,从而导致试图跨平台匹配行为的混乱.

There are of course platform specific versions of these, but they hardly ever do exactly the same thing leading to chaos trying to match behaviour across platforms.

我的意思是C,而不是C ++,所以boost不算数.

And I mean C, not C++, so boost doesn't count.

如果没有,那么是否存在平台之间差异的良好来源/示例以及可用于编写此类库的其他有用信息?

Also if there is none, are there any good sources/examples of differences between platforms, and other useful information that can be used to write such a library?

推荐答案

我知道这是一个比较老的问题,但是我一直在寻找类似的东西,但找不到任何东西.所以我写了一个 cwalk (

I know this is a rather old question, but I have been looking for something like this and couldn't find anything. So I wrote one, cwalk (reference) - for anyone who still finds it useful! :-)

这篇关于是否有C的跨平台文件IO/路径util库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆