为什么用C重命名工作不正常? [英] Why Rename in C not working correctly?

查看:153
本文介绍了为什么用C重命名工作不正常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是工作正常前一阵子。但我不知道什么是错误。

It was working correctly a while ago. But i dont know what was is the error.

我的code:

char oldfn[] = "d://booksdata.txt";
char newfn[] = "d://booksdata_temp.txt";
remove(oldfn);
rename(newfn, oldfn);

删除功能才能正常工作,但我的重命名功能不起作用。

Remove function works correctly but my rename function does not work.

推荐答案

从ISO / IEC9899:

From ISO/IEC9899:

7.19.4.2重命名功能

7.19.4.2 The rename function

简介

1 的#include< stdio.h中>

INT重命名(为const char *的时候,为const char *新);

你可以通过原型看到:您正在使用在错误的地方新旧参数

As you can see by the prototype: you are using the old and new arguments in the wrong place.

只需切换,然后和一个错误是固定的。
如果还有一招......告诉我们错误的文字吧。

Just switch then and one error is fixed. If there is still one... Tell us the error text please.

这篇关于为什么用C重命名工作不正常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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