void SourceDialog::initMenuPopupTreeParam() { Gtk::Menu::MenuList& menulist(mMenuTreeViewItems.items()); menulist.push_back( Gtk::Menu_Helpers::MenuElem( ("_Add"), sigc::mem_fun( *this, &SourceDialog::onAddParam))); menulist.push_back( Gtk::Menu_Helpers::MenuElem( ("_Delete"), sigc::mem_fun( *this, &SourceDialog::onDeleteParam))); menulist.push_back( Gtk::Menu_Helpers::MenuElem( ("_Rename"), sigc::mem_fun( *this, &SourceDialog::onRenameParam))); mMenuTreeViewItems.accelerate(*mTreeViewParam); }
void AckFunctionDialog::initMenuPopupTreeAckList() { Gtk::Menu::MenuList& menulist(mMenuTreeViewItems.items()); menulist.push_back( Gtk::Menu_Helpers::MenuElem( ("_Add"), sigc::mem_fun( *this, &AckFunctionDialog::onAddAck))); menulist.push_back( Gtk::Menu_Helpers::MenuElem( ("_Delete"), sigc::mem_fun( *this, &AckFunctionDialog::onDeleteAck))); menulist.push_back( Gtk::Menu_Helpers::MenuElem( ("_Rename"), sigc::mem_fun( *this, &AckFunctionDialog::onRenameAck))); mMenuTreeViewItems.accelerate(*mTreeAckList); }
int main() { int Val; mysql_init(&conn);//연결 지시자 초기화 connection = mysql_real_connect(&conn, DB_HOST, DB_USER, DB_PASS, DB_NAME, 3306, (char *)NULL, 0);//mysql서버에 직접 접근 if (connection == NULL){ fprintf(stderr, "MySQL Connection Error :%s", mysql_error(&conn)); return 1; } while (1) { icnt = checkfile(); menulist(); fprintf(stdout, "Menu Select = "); fscanf(stdin, "%d", &Val); getchar(); switch (Val) { case 1: { while (1) { Datainput(); icnt++; break; } break; } case 2:{ while (1){ deleteData(); icnt--; break; } } case 3: { datalist(); break; } case 4:{ run_server(); break; } case 5: { printf("Program Exit!!\n"); return 0; } default: return 0; } } return 0; }
int main(){ int sockfd; int len, val; int cnt=1; char str[50]; struct sockaddr_un address; int result; while(1){ //client socket create sockfd = socket(AF_UNIX, SOCK_STREAM, 0); //server socket name direction address.sun_family = AF_UNIX; strcpy(address.sun_path, "server_socket"); len = sizeof(address); result = connect(sockfd, (struct sockaddr *)&address, len); //connect() 서버로 접속 시도 if (result == -1){ perror("client 1"); exit(1); }else { sprintf(str, "%d번 clinet Connect\n",cnt); write(sockfd, &str, 50); } char ch; menulist(); fprintf(stdout, "Menu Select = "); fscanf(stdin, "%d", &val); getchar(); switch(val){ case 1:{//책목록 ch='1'; write(sockfd, &ch, 1); break; } case 2:{//책대여 ch='2'; write(sockfd, &ch, 1); char name[20]; int bookLen, tmp; printf("빌릴 책이름을 입력하세요: "); fgets(name, 20, stdin); CHOP(name); bookLen = strlen(name); write(sockfd, &bookLen, 1);//1 write(sockfd, &name, bookLen);//2 read(sockfd, &tmp, 1); if (tmp == 1){ printf("책 %s가 정상적으로 대여가 완료되었습니다.\n", name); } else{ printf("요청하신 책이 없습니다. 다른 책을 대여해보세요.\n"); } //close(sockfd); break; } case 3:{//책반납 } case 4:{//내가빌린책 } case 5:{//종료하기 printf("Program Exit!!\n"); return 0; } default: return 0; } } close(sockfd); exit(0); }