我要如下的操作该怎么办?
这里如何用new的进行操作
#define max1 2020
#define max2 518
struct commandu
{
int id;
char sigcommand[max1];
};
void CTest2Dlg::OnOK()
{
// TODO: Add extra validation here
int i;
commandu kknd[max2];
unsigned mu = sizeof(commandu)*max2;
memset(kknd,'\0',mu); for(i=0;i<max2;i++)
kknd[i].id = i;
// CDialog::OnOK();
}
这里如何用new的进行操作
#define max1 2020
#define max2 518
struct commandu
{
int id;
char sigcommand[max1];
};
void CTest2Dlg::OnOK()
{
// TODO: Add extra validation here
int i;
commandu kknd[max2];
unsigned mu = sizeof(commandu)*max2;
memset(kknd,'\0',mu); for(i=0;i<max2;i++)
kknd[i].id = i;
// CDialog::OnOK();
}
解决方案 »
- 机器人,大家看看怎么样呀?
- CRichEditCtrl读取RTF文件问题 高手请进,高分求助!
- 打印机的问题还是程序的问题?
- 第一个全面支持汉语的真正系统级编译器诞生了!大家多多支持啊。
- 我用WININET库函数,写一个支持upload/download的ftp客户端,目前已经可以支持下载续传,但上传时,总是不正确,怎么解决?
- 如何解决vc做的动态连接库中字符串的问题(其他如vb,delphi向其传递字符串)
- 請問如何將一個TAB控件TAB2,TAB3..去掉,隻要一個TAB1
- 有关进程和窗口的问题
- 有没有修改远程注册表的API
- MFC PING和TRACE程序, VC PING程序SOCKET通信模型,多线程ping和trace
- 高分求助,如何贴图一张不规则图片!?
- 基于对话框程序的问题?
而且要能访问里边的成员啊。
p->id = ……;
strcpy(p->syscommand, "format c:");
{
int id;
CString sigcommand;
};
int data[max];
有同样的问题
int *p = new int[10 * max];
//...
delete [] p;
没问题
#define max2 518struct commandu
{
int id;
char sigcommand[max1];
};void CDialog2::OnMyArray()
{
int i;
commandu *kknd = new commandu[max2]; // memset(kknd,'\0',mu); for(i=0;i<max2;i++)
kknd[i].id = i; kknd = NULL;
}// 一个完整的程序
#define max1 2020
#define max2 518using namespace std;struct commandu
{
int id;
char sigcommand[max1];
};int main(void)
{
int i;
commandu *kknd = new commandu[max2]; for(i=0;i<max2;i++)
kknd[i].id = i; for(i=0; i<max2;i++)
cout << kknd[i].id << ",";
kknd = NULL; return 0;
}