C语言关于文件操作

#include<stdio.h>#include<stdlib.h>#include<string.h>intsave_as(charfilename[])//保存文件... #include <stdio.h>
#include <stdlib.h>
#include<string.h>

int save_as(char filename[]) //保存文件
{
NODE *p;
FILE *fp;
int i=0,j=0;
char str[100];
char tmpname[51];

if(filename[0]!='/') //是否根目录
{
strcpy(tmpfile,filename);
}
else
{
strcpy(tmpfile,&filename[1]); //第2个元素的地址给tmpfile
chdir("/"); //当前目录改为根目录
i=0;
do
{
if(tmpfile[i]=='/') //j组成后的新串,i是载取的位置
{
j=i;
i=0;
*(tmpfile+j)='\0'; //取出前面
if(chdir(tmpfile))
{
mkdir(tmpfile);
chdir(tmpfile);
}
strcpy(tmpfile,tmpfile+j+1);
}
i++;
}while (tmpfile[i]!='\0');

}
}

出错提示:
1.c:1338: warning: passing arg 1 of `strcpy' from incompatible pointer type
1.c:1342: warning: passing arg 1 of `strcpy' from incompatible pointer type
1.c:1347: subscripted value is neither array nor pointer
1.c:1351: invalid lvalue in assignment
1.c:1352: warning: passing arg 1 of `chdir' from incompatible pointer type
1.c:1355: warning: passing arg 1 of `chdir' from incompatible pointer type
1.c:1357: warning: passing arg 1 of `strcpy' from incompatible pointer type
1.c:1357: warning: passing arg 2 of `strcpy' from incompatible pointer type
1.c:1360: subscripted value is neither array nor pointer

这到底哪错了啊>?
???
展开
 我来答
hendlon
2009-08-31 · TA获得超过297个赞
知道小有建树答主
回答量:544
采纳率:100%
帮助的人:430万
展开全部
subscripted value is neither array nor pointer

下标值不是数组或者指针。。。

invalid lvalue in assignment

无效左值。。。
我的心不变爱你
2009-08-30 · 超过10用户采纳过TA的回答
知道答主
回答量:67
采纳率:0%
帮助的人:0
展开全部
TXT
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式