这篇教程C++ write_config函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中write_config函数的典型用法代码示例。如果您正苦于以下问题:C++ write_config函数的具体用法?C++ write_config怎么用?C++ write_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了write_config函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: verifySDownConditionsvoid verifySDownConditions(void){ if(sDown_filtered < SDown_Threshold) { if(sd_printing) { initPause(); config.status = 9; write_config(); sd_printing = false; queue_flush(); reset_current_block(); home_z(); } else if(printerPause) { config.status = 9; write_config(); sd_printing = false; queue_flush(); reset_current_block(); home_z(); } }}
开发者ID:beeverycreative,项目名称:beethefirst-firmware,代码行数:30,
示例2: notify_action/* * the notify_action_* functions get called when the user clicks on * the respective buttons we put in the notification window. * user_data contains the string we pass, so "yes" "no" "always" or "never". */static void notify_action(NotifyNotification __unused *notify, gchar __unused *action, gpointer user_data){ char *answer = (char *) user_data; send_permission(answer); detail_file_name = NULL; if (strcmp(answer, "always") == 0) write_config("always"); if (strcmp(answer, "never") == 0) write_config("never"); gtk_status_icon_set_visible(statusicon, FALSE);}
开发者ID:rbalint,项目名称:kerneloops,代码行数:18,
示例3: set_cluster_storeint set_cluster_store(const char *name){ memset(config.store, 0, sizeof(config.store)); pstrcpy((char *)config.store, sizeof(config.store), name); return write_config();}
开发者ID:rdndnl,项目名称:sheepdog,代码行数:7,
示例4: new_arraybool ConfigFile::remove_rom_id_1(std::string package, std::string rom_id) { const Json::Value syncacross = m_root[CONF_PACKAGES][package][CONF_SYNC_ACROSS]; if (syncacross.isNull() || !syncacross.isArray()) { return false; } bool removed = false; // jsoncpp has no built-in way of removing items from an array Json::Value new_array(Json::arrayValue); for (unsigned int i = 0; i < syncacross.size(); i++) { std::string value = syncacross[i].asString(); if (rom_id == value) { removed = true; continue; } new_array.append(value); } if (new_array.size() == 0) { m_root[CONF_PACKAGES].removeMember(package); removed = true; } else { m_root[CONF_PACKAGES][package][CONF_SYNC_ACROSS] = new_array; } if (removed) { write_config(); } return removed;}
开发者ID:Kratos1982,项目名称:DualBootPatcher,代码行数:34,
示例5: init_config_fileint init_config_file(void){ int fd, ret; check_tmp_config(); fd = open(config_path, O_RDONLY); if (fd < 0) { if (errno != ENOENT) { sd_eprintf("failed to read config file, %m"); return -1; } goto create; } ret = xread(fd, &config, sizeof(config)); if (ret == 0) { close(fd); goto create; } if (ret < 0) { sd_eprintf("failed to read config file, %m"); goto out; } if (config.version != SD_FORMAT_VERSION) { sd_eprintf("This sheep version is not compatible with" " the existing data layout, %d", config.version); if (sys->upgrade) { /* upgrade sheep store */ ret = sd_migrate_store(config.version, SD_FORMAT_VERSION); if (ret == 0) { /* reload config file */ ret = xpread(fd, &config, sizeof(config), 0); if (ret != sizeof(config)) { sd_eprintf("failed to reload config" " file, %m"); ret = -1; } else ret = 0; } goto out; } sd_eprintf("use '-u' option to upgrade sheep store"); ret = -1; goto out; } ret = 0;out: close(fd); return ret;create: config.version = SD_FORMAT_VERSION; if (write_config() != SD_RES_SUCCESS) return -1; return 0;}
开发者ID:rdndnl,项目名称:sheepdog,代码行数:60,
示例6: terminatevoid terminate (void){ /* int fh[10000], i; char buffer[100]; for (i=0; i<10000; i++) { sprintf (buffer, "file%d", i); fh[i] = open (buffer, O_CREAT|O_WRONLY); if (fh[i] < 0) break; } close (fh[0]); */ write_config (); video_update (0); set_window_name (wintitle); fly_terminate ();#ifdef __MINGW32__ WSACleanup ();#endif}
开发者ID:OS2World,项目名称:APP-INTERNET-NFTP,代码行数:25,
示例7: read_configstatic void read_config(void){ gchar *path; gboolean initial = FALSE; debug_print("autoenc: read_config/n"); path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "autoencrc", NULL); if (!is_file_exist(path)) { initial = TRUE; prefs_set_default(param); } else { prefs_read_config(param, "AutoEncrypt", path, NULL); } if (!config.autoenc_template_subject) { config.autoenc_template_subject = g_strdup(_("Password of encrypted file")); } if (!config.autoenc_template_body) { config.autoenc_template_body = g_strdup(_("Subject: %s//n" "Date: %d//n" "The password of the encrypted file attached in the above mail is as follows://n" "//n" "File name: %z//n" "Password: %p")); } if (initial) { write_config(); } g_free(path);}
开发者ID:y-hiroyu,项目名称:sylpheed-autoenc-plugin,代码行数:34,
示例8: project_close/* open_default will make function reload default session files on close */void project_close(gboolean open_default){ GSList *node; g_return_if_fail(app->project != NULL); ui_set_statusbar(TRUE, _("Project /"%s/" closed."), app->project->name); /* use write_config() to save project session files */ if (!write_config(FALSE)) g_warning("Project file /"%s/" could not be written", app->project->file_name); /* remove project filetypes build entries */ if (app->project->build_filetypes_list != NULL) { g_ptr_array_foreach(app->project->build_filetypes_list, remove_foreach_project_filetype, NULL); g_ptr_array_free(app->project->build_filetypes_list, FALSE); } /* remove project non filetype build menu items */ build_remove_menu_item(GEANY_BCS_PROJ, GEANY_GBG_NON_FT, -1); build_remove_menu_item(GEANY_BCS_PROJ, GEANY_GBG_EXEC, -1); g_free(app->project->name); g_free(app->project->description); g_free(app->project->file_name); g_free(app->project->base_path); g_free(app->project); app->project = NULL; foreach_slist(node, stash_groups) stash_group_free(node->data); g_slist_free(stash_groups); stash_groups = NULL; apply_editor_prefs(); /* ensure that global settings are restored */ if (project_prefs.project_session) { /* close all existing tabs first */ document_close_all(); /* after closing all tabs let's open the tabs found in the default config */ if (open_default && cl_options.load_session) { configuration_reload_default_session(); configuration_open_files(); /* open a new file if no other file was opened */ document_new_file_if_non_open(); ui_focus_current_document(); } } g_signal_emit_by_name(geany_object, "project-close"); update_ui();}
开发者ID:Nordvind,项目名称:geany,代码行数:59,
示例9: write_configvoid server::handle_flush(const boost::system::error_code& error){ if(error) { ERR_CS << "Error from reload timer: " << error.message() << "/n"; throw boost::system::system_error(error); } write_config(); flush_cfg();}
开发者ID:Wedge009,项目名称:wesnoth,代码行数:9,
示例10: write_configJNIEXPORT jboolean JNICALL Java_com_fastrunningblog_FastRunningFriend_ConfigState_write_1config (JNIEnv *env, jobject this_obj, jstring profile_name){ jboolean res; const char* profile_name_s = (*env)->GetStringUTFChars(env,profile_name,0); res = write_config(env,this_obj,profile_name_s); (*env)->ReleaseStringUTFChars(env,profile_name,profile_name_s); return res;}
开发者ID:cDoru,项目名称:fast_running_friend,代码行数:9,
示例11: Java_com_fastrunningblog_FastRunningFriend_GPSCoordBuffer_init_1data_1dirJNIEXPORT jbooleanJava_com_fastrunningblog_FastRunningFriend_GPSCoordBuffer_init_1data_1dir( JNIEnv* env, jobject this_obj, jstring dir_name_str ){ struct stat s; jboolean status = 0; const char *dir_name = (*env)->GetStringUTFChars(env, dir_name_str, NULL); int dir_created = 0; gps_data_dir[0] = 0; if (!dir_name) goto err; if (stat(dir_name,&s)) { jobject cfg_obj; if (mkdir(dir_name,0755)) goto err; dir_created = 1; if (!(cfg_obj = (*env)->GetObjectField(env,this_obj,gps_buf_fields.cfg_id))) { LOGE("Could not find config object while writing default config file"); goto done; } if (!write_config(env,cfg_obj,"default")) LOGE("Error writing default config file"); goto done; } if ((s.st_mode & S_IFMT) != S_IFDIR) goto err;done: gps_data_dir_len = strlen(dir_name); if (gps_data_dir_len > sizeof(gps_data_dir) - 1) goto err; memcpy(gps_data_dir,dir_name,gps_data_dir_len+1); status = 1; if (!dir_created) remove_expired_files(env,this_obj,gps_data_dir); err: if (dir_name) (*env)->ReleaseStringUTFChars(env,dir_name_str,dir_name); return status;}
开发者ID:cDoru,项目名称:fast_running_friend,代码行数:55,
示例12: s2e_clearint s2e_clear (HTTP_INFO *info){ int chan; for (chan = 0; chan < S2E_CHAN_MAX; chan ++) { default_config (chan, &s2e_conf[chan]); write_config (chan, &s2e_conf[chan]); } return 0;}
开发者ID:meloun,项目名称:lnx_myweb,代码行数:11,
示例13: set_cluster_configint set_cluster_config(const struct cluster_info *cinfo){ config.ctime = cinfo->ctime; config.copies = cinfo->nr_copies; config.copy_policy = cinfo->copy_policy; config.flags = cinfo->flags; memset(config.store, 0, sizeof(config.store)); pstrcpy((char *)config.store, sizeof(config.store), (char *)cinfo->store); return write_config();}
开发者ID:Seagate,项目名称:kinetic-sheepdog,代码行数:11,
示例14: Settings void write_config ( const Ch* a_filename, const basic_variant_tree<Ch>& a_tree, config_format a_format, const Settings& a_settings = Settings(), const std::locale & a_loc = std::locale() ) { write_config(std::basic_string<Ch>(a_filename), a_tree, a_format, a_settings, a_loc); }
开发者ID:greenalpha,项目名称:utxx,代码行数:11,
示例15: write_config void LoginWidget::set_connected (bool connected) { QString status; if (connected) { status = "Connected to " + edit_host_->text(); write_config(); } else status = "Offline"; label_status_->setText(status); }
开发者ID:sempuki,项目名称:scaffold,代码行数:12,
示例16: memcpyvoidon_button4_clicked (GtkButton *button, gpointer user_data){ memcpy(host,(char *)gtk_entry_get_text ((GtkEntry *)entry4),strlen((gchar *)gtk_entry_get_text ((GtkEntry *)entry4)));write_config((gchar *)gtk_entry_get_text ((GtkEntry *)entry1), ""); get_socket((char *)gtk_entry_get_text ((GtkEntry *)entry4)); getAtrBox = create_messagebox("提示","恭喜,获取服务成功!",1); gtk_widget_show (getAtrBox); return;//sorry i can not understand what is this}
开发者ID:54chen,项目名称:MyNet,代码行数:13,
示例17: send_errorvoid server::handle_delete(const server::request& req){ const config& erase = req.cfg; if(read_only_) { LOG_CS << "in read-only mode, request to delete '" << erase["name"] << "' from " << req.addr << " denied/n"; send_error("Cannot delete add-on: The server is currently in read-only mode.", req.sock); return; } LOG_CS << "deleting campaign '" << erase["name"] << "' requested from " << req.addr << "/n"; config& campaign = get_campaign(erase["name"]); if(!campaign) { send_error("The add-on does not exist.", req.sock); return; } if(!authenticate(campaign, erase["passphrase"]) && (campaigns()["master_password"].empty() || campaigns()["master_password"] != erase["passphrase"])) { send_error("The passphrase is incorrect.", req.sock); return; } // Erase the campaign. filesystem::write_file(campaign["filename"], std::string()); if(remove(campaign["filename"].str().c_str()) != 0) { ERR_CS << "failed to delete archive for campaign '" << erase["name"] << "' (" << campaign["filename"] << "): " << strerror(errno) << '/n'; } config::child_itors itors = campaigns().child_range("campaign"); for(size_t index = 0; !itors.empty(); ++index, itors.pop_front()) { if(&campaign == &itors.front()) { campaigns().remove_child("campaign", index); break; } } write_config(); send_message("Add-on deleted.", req.sock); fire("hook_post_erase", erase["name"]);}
开发者ID:Wedge009,项目名称:wesnoth,代码行数:51,
示例18: write_configvoidon_button1_clicked (GtkButton *button, gpointer user_data){ if(gtk_toggle_button_get_active((GtkToggleButton *)checkbutton1))write_config((gchar *)gtk_entry_get_text ((GtkEntry *)entry1), (gchar *)gtk_entry_get_text ((GtkEntry *)entry2));elsewrite_config((gchar *)gtk_entry_get_text ((GtkEntry *)entry1), ""); gtk_widget_hide_all (window1);linkwindow = create_window3 ();gtk_widget_show_all (linkwindow);gint ptimer_flash=0;gtk_timeout_remove(ptimer_flash);ptimer_flash=gtk_timeout_add(15000,flash_timeout,NULL); pthread_t getaccess;Acc_Keep_Link=0;memcpy(username,(char *)gtk_entry_get_text ((GtkEntry *)entry1),strlen((char *)gtk_entry_get_text ((GtkEntry *)entry1)));memcpy(passwd,(char *)gtk_entry_get_text ((GtkEntry *)entry2),strlen((char *)gtk_entry_get_text ((GtkEntry *)entry2)));pthread_create(&getaccess,NULL,Access_Thread,NULL);}
开发者ID:54chen,项目名称:MyNet,代码行数:23,
示例19: cli_frontend_exitvoid cli_frontend_exit(void){ /* close open files */ if (logfile) fclose(logfile); if (options.playback) mame_fclose(options.playback); if (options.record) mame_fclose(options.record); if (options.language_file) mame_fclose(options.language_file);#ifdef MESS if (win_write_config) write_config(NULL, Machine->gamedrv);#endif /* MESS */}
开发者ID:gfonseca,项目名称:mame078-libretro,代码行数:14,
示例20: savevoid save(){ gtk_color_button_get_color(GTK_COLOR_BUTTON(button_bcolor), &bcolor); gtk_color_button_get_color(GTK_COLOR_BUTTON(button_fcolor), &fcolor); struct v *p = st; int i; for(i = 0; i < c; i++){ set_data(p); p = p -> next; } gtk_color_button_set_color(GTK_COLOR_BUTTON(button_bcolor), &bcolor); gtk_color_button_set_color(GTK_COLOR_BUTTON(button_fcolor), &fcolor); write_config();}
开发者ID:inf0-warri0r,项目名称:multi_terminal,代码行数:15,
示例21: sprintfvoidbefore_quit (GtkWidget *widget, gpointer user_data){/*char cfgfile[1024]="";sprintf(cfgfile,"%s/.mynet/run.pid",getenv("HOME"));unlink(cfgfile);//delete mutex file*/ if(gtk_toggle_button_get_active((GtkToggleButton *)checkbutton1))write_config((gchar *)gtk_entry_get_text ((GtkEntry *)entry1), (gchar *)gtk_entry_get_text ((GtkEntry *)entry2));//remember the passwdclose(sockfd); gtk_main_quit();}
开发者ID:54chen,项目名称:MyNet,代码行数:15,
示例22: display_options/* display the option dialog */void display_options(nh_bool change_birth_opt){ struct nh_menuitem *items; int icount, size; struct nh_option_desc *nhoptions = nh_get_options(GAME_OPTIONS); struct nh_option_desc *birthoptions = NULL; int n; size = 10; items = malloc(sizeof(struct nh_menuitem) * size); do { icount = 0; if (!change_birth_opt) { birthoptions = nh_get_options(ACTIVE_BIRTH_OPTIONS); /* add general game options */ add_menu_txt(items, size, icount, "游戏设置:", MI_HEADING); menu_add_options(&items, &size, &icount, GAME_OPTS, nhoptions, FALSE); /* add or display birth options */ add_menu_txt(items, size, icount, "本次游戏人物设置:", MI_HEADING); menu_add_options(&items, &size, &icount, ACT_BIRTH_OPTS, birthoptions, TRUE); } else { birthoptions = nh_get_options(CURRENT_BIRTH_OPTIONS); /* add or display birth options */ add_menu_txt(items, size, icount, "创建人物设置:", MI_HEADING); menu_add_options(&items, &size, &icount, CUR_BIRTH_OPTS, birthoptions, FALSE); add_menu_txt(items, size, icount, "游戏设置:", MI_HEADING); menu_add_options(&items, &size, &icount, GAME_OPTS, nhoptions, FALSE); } /* add UI specific options */ add_menu_txt(items, size, icount, "界面设置:", MI_HEADING); menu_add_options(&items, &size, &icount, UI_OPTS, curses_options, FALSE); n = curses_display_menu_core(items, icount, "选择哪个设置?", PICK_ONE, NULL, 0, 0, -1, -1, get_option_value, FALSE); } while (n > 0); free(items); write_config();}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:48,
示例23: sizeofboolHMC5883L::begin(){ // Read the device identity register uint8_t id[3]; twi.begin(this); twi.write((uint8_t) IDENTITY); twi.read(id, sizeof(id)); twi.end(); // Sanity check the identity static const uint8_t ID[3] __PROGMEM = { 'H', '4', '3' }; if (memcmp_P(id, ID, sizeof(ID))) return (false); // Write configuration return (write_config());}
开发者ID:rrobinet,项目名称:Cosa,代码行数:17,
注:本文中的write_config函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ write_cr0函数代码示例 C++ write_command函数代码示例 |