我的 GTK 程序仍然有问题。
当我单击编码(或解码)按钮时,我收到错误消息:
分段故障
我认为问题来自功能:ret
但encode
找不到。
//..
//gets the first argument(buf)
tx1=gtk_entry_get_text(GTK_ENTRY(entry));
//...
//gets the second argument(pass)
tx2=gtk_entry_get_text(GTK_ENTRY(entry));
//....
//signal to callback function encode when button clicked
g_signal_connect(but,"clicked",G_CALLBACK(encode(tx1,tx2)),NULL);
// ...
//convert const char* to char*
char* ret (const char *bd){
char *c = new char[12];
strcpy(c,bd);
return c;
}
//encode function
char encode(const char ebuf[],const char epass[]) {
//This is the complete function I wrote and I am still having the error.
char *buf=ret(ebuf);
char *pass=ret(epass);
}