读书人

v2010编译环境下 c语言的文件读显有关

发布时间: 2012-03-26 15:46:55 作者: rapoo

求教:v2010编译环境下 c语言的文件读显问题!!
、、、、、、、、、、、、、、代码如下、、、、、、、、、、、、、、、
#include "stdafx.h"
#include "stdlib.h"

int _tmain(int argc, _TCHAR* argv[])
{
FILE *fpGrade;
fpGrade = fopen("C:/tx.txt","rb");
if (fpGrade == 0)
{
printf("\nConnot open file\n");
}
fseek(fpGrade,0,SEEK_END);
int len = ftell(fpGrade);
fseek(fpGrade,0,SEEK_SET); [code=C/C++][/code]
char *pbuffer = new char[len];
fread(pbuffer,1,len,fpGrade);
printf("%s",pbuffer);
system("PAUSE");
}
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

编译出现以下错误:
debug assertion failed!(后面一大串)
、、、

在同学的电脑上运行相同的程序没有错,并打印txt内容,但是在我的电脑上却不行,蛋疼、、、、
--


[解决办法]
那程序可能没有问题,
问题可能在于你的文件本身,
文件名和地址,属性是否正确
[解决办法]
编译就会出现这个问题?不会吧?应该是运行的时候才会出这种问题。。。

读书人网 >C语言

热点推荐