Expression: *file !=_T(‘\0’)File:fopen.c line:54
//输入文件,统计文件的字节长度
#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();
#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();
...全文
相关推荐
C语言语法笔记
fopen("test.txt", "w"); assert(fp !
The Standard C Library 经典的基础.docx
```c FILE *f = fopen("example.txt", "r"); ``` - **重新定向流**:`freopen()`可以更改当前流所关联的文件。
正则表达式regular expression详述 最全
`$`(美元符号):匹配输入字符串的结束位置。4. `*`:匹配前面的字符0次或多次。5. `+`:匹配前面的字符1次或多次,相当于`{1,}`。6. `?
C语言语法着色函数大全
(FILE *stream, const void *buf, size_t size, size_t nitems, off_t offset);` - **说明**:这些函数可以跳过文件指针进行读写操作
editpluspython配置.pdf
在 "Regular expression" 栏中,输入正则表达式:File "(.+)", line ([0-9]+)。5.


