用等效的Linux替换_fullpath [英] Replace _fullpath with Linux equivalent

查看:422
本文介绍了用等效的Linux替换_fullpath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码继承自c ++ DOS文件。



I have the following code inherited from a c++ DOS file.

_fullpath ( audit_log , filename , 256 ) ;





我需要替换这段代码,以便我可以用g ++编译Linux版本并发现函数realpath所以打算进行以下替换:





I need to replace this code so that I can compile in g++ for Linux and found function realpath so intend to make following replacement:

realpath( filename , audit_log );





我可以确认:



1.前两个输入确实应该反转。



2.是否有一种简单的方法可以在realpath函数中指定256的缓冲区长度?我想我使用realpath得到了与缓冲区长度相关的错误。



Can I confirm that:

1. The first two inputs should indeed be reversed.

2. Is there an easy way to specify buffer length of 256 in the realpath function? I think I'm getting errors associated with buffer length using realpath.

推荐答案

1。是的,他们是相反的。



https:/ /msdn.microsoft.com/en-us/library/506720ff.aspx [ ^ ]

http:// linux。 die.net/man/3/realpath [ ^ ]



2. Linux有PATH_MAX,Windows使用_MAX_PATH。你可以使char缓冲这个大小。
1. yes they are reversed.

https://msdn.microsoft.com/en-us/library/506720ff.aspx[^]
http://linux.die.net/man/3/realpath[^]

2. Linux has PATH_MAX and Windows uses _MAX_PATH. You can make char buffer this size.


这篇关于用等效的Linux替换_fullpath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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