参考までに正しい例。
----------------------------------------------------
int init_check_func(char *buf, char **cbuf, int arrange){
return 0;
}
int MSGCHK_func(char *buff){
int Ret = 0;
char *combuff[6];
for(int n = 0; n < 6; n++){
combuff[n] = (char*)calloc(8, 1);
}
strcpy(combuff[0], "ERROR");
strcpy(combuff[1], "OFFLINE");
strcpy(combuff[2], "DISABLE");
strcpy(combuff[3], "ACTIVE");
strcpy(combuff[4], "WARNING");
strcpy(combuff[5], "DOWN");
Ret = init_check_func(buff, combuff, 6);
for(n = 0; n < 6; n++){
free(combuff[n]);
}
return Ret;
}
----------------------------------------------------
または、
----------------------------------------------------
typedef char CHAR8[8];
int init_check_func(char *buf, CHAR8 *cbuf, int arrange){
return 0;
}
int MSGCHK_func(char *buff){
int Ret = 0;
char combuff[6][8];
memset(combuff,'\0', sizeof combuff);
strcpy(combuff[0], "ERROR");
strcpy(combuff[1], "OFFLINE");
strcpy(combuff[2], "DISABLE");
strcpy(combuff[3], "ACTIVE");
strcpy(combuff[4], "WARNING");
strcpy(combuff[5], "DOWN");
Ret = init_check_func(buff, combuff, 6);
return Ret;
}
----------------------------------------------------
長くてすみません。
ちなみに、OKWEBは行頭のスペースを削除してくれちゃうので、見にくいですね。
このようにメモリ配置とかの勉強ばっかして、実用プログラムをぜんぜん作ったことのないhaporunでした。
ちなみに、本職はVBです。
補足
コンパイラ:VC++ OS:NT4.0SP6 //ここから int MSGCHK_func(char* buff) { int Ret = 0; char combuff[6][8]; memset(combuff,'\0',sizeof(combuff)); strcpy( combuff[0], "ERROR"); strcpy( combuff[1], "OFFLINE"); strcpy( combuff[2], "DISABLE"); strcpy( combuff[3], "ACTIVE"); strcpy( combuff[4], "WARNING"); strcpy( combuff[5], "DOWN"); Ret = init_check_func( buff, (char**)combuff, 6); return(Ret); } int init_check_func( char* buf, char** cbuf ,int arrange) { } //ここまで よろしくお願いします。