64,691
社区成员
发帖
与我相关
我的任务
分享
//FILE *fp = NULL;
//fp = fopen("C:\\1.txt","rb");
char *cert = NULL;
int len = -1,num = -1;
//len = fseek(fp,0,SEEK_END);
//num = ftell(fp);
cert = new char[len+1];
/*memset(cert,0,len+1);
len = fseek(fp,0,SEEK_SET);
//rewind(fp);
fread((void*)cert,sizeof(char),num,fp);
cert[num] = '\0';
OutputDebugString((char*)cert);
fclose(fp);
printf("%s\n",(char*)cert);
*/
delete []cert; //报错 ?
include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main()
{
char *cert = NULL;
int len = 9;
cert = new char[len+1];
cert[0] = 'a';
cert[10] = 'a';
cout<<cert<<endl;
delete []cert;
cout<<cert<<endl;
return 0;
}