考虑到我有一个程序(plus x y)巫婆只需要两个args.现在我还有一个包含两个对象的列表(list 1 2).所以,如果有任何神奇的方法将列表扩展为两个参数.我们有一个点概念版本,但这不是我想要的.我只想扩展列表使Scheme相信我传递了两个参数而不是列表.
希望这些Ruby代码有所帮助:
a = [1, 2]
def plus(x,y); x+y; end
plus(*a)
# See that a is an array and the plus method requires
# exactly two arguments, so we use a star operator to
# expand the a as arguments
Run Code Online (Sandbox Code Playgroud) 所以,我只写:
int fdes = open(path, O_WRONLY | O_CREAT | O_TRUNC);
Run Code Online (Sandbox Code Playgroud)
如果path引用的文件不存在,则此代码有效.但如果确实如此,则代码返回errno13:Permission Denied.我从来没有使用过O_EXCL模式.
我很长一段时间都在寻找解决这个问题的方法,我真的很困惑.你能解释一下这个问题吗?
我使用GCC for windows(4.5.2).您的回答将不胜感激.