在C中打开另一个目录中的文件
这是如何实现的?我想使用
pFile = fopen( file, "rb" );
Where file is a char, string or long 包含包含二进制文件本地路径的文字文本,
C:\Documents and Settings\Supernovah\Desktop\Supernovah.bin
但这当然会崩溃。
我还对如何以可移植的方式重复当前目录感兴趣。 windows.h 有点难看,但如果我不能以可移植的方式做到这一点。就这样吧。
谢谢 :)
How is this achieved? I want to use
pFile = fopen( file, "rb" );
Where file is a char, string or long containing the literal text containing a local path to a binary file
C:\Documents and Settings\Supernovah\Desktop\Supernovah.bin
but of course that crashes.
I am also interested in how to recur over the current directory in a portable way. windows.h is a little ugly but if I can't do it in a portable way. So be it.
thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
GCC/MinGW 和 VC++ 2008(可能还有其他)都允许 Win32 中的 Unix 样式路径分隔符。 so:
也可以工作,并且可以在操作系统之间移植。然而,路径中的空格可能会出现问题,需要在 Linux 中替换为 %20。
Both GCC/MinGW and VC++ 2008 (and probably others) allow Unix style path delimiters in Win32. so:
would work as well, and is portable between operating systems. Spaces in paths however may be problematic, requiring replacement with %20 in Linux.