Expression: *file !=_T(‘\0’)File:fopen.c line:54

sd86772746 sd86772746 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
//输入文件,统计文件的字节长度
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include "function1.h"
using namespace std;

void function1()
{
cout<<endl;
char filename[256];
long length;
cout<<"请输入文件名:";
gets(filename);
FILE *fp=fopen(filename,"rb");//以二进制读文件方式打开文件
if( fp==NULL)
cout<<"file not found!\n";
else
{
fseek(fp,0L,SEEK_END);//把文件的位置指针移到文件尾
length=ftell(fp);//获取文件长度;
printf("该文件的长度为%1d字节\n",length);

}
fclose(fp);
getch();
}

为什么老是会出现标题所示错误呢!?
假如是单一创建的话,又可以运行……


int main(int argc, char* argv[])
{

cout<<"欢迎使用文件操作软件"<<endl<<endl;
cout<<"本软件功能介绍:1、统计文件字节数;2、选择性文件复制;3、文件合并;4、文件比较;5、内容查找"<<endl;


int function;
cout<<"请输入 1、2、3、4、5以选择文件操作功能:";
cin>>function;

if(function==1)
function1();
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
sd86772746
C++ 语言 65,214 成员 250,514 内容