您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ strtobool函数代码示例

51自学网 2021-06-03 08:32:24
  C++
这篇教程C++ strtobool函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中strtobool函数的典型用法代码示例。如果您正苦于以下问题:C++ strtobool函数的具体用法?C++ strtobool怎么用?C++ strtobool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了strtobool函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: qDebug

CQueryWindowOptionsDialog::query_config_options CQueryWindowOptionsDialog::readConfig(CConfig *cfg){#ifdef DEBUG  qDebug("static query_config_options::readConfig(CMySQLServer *)");#endif  query_config_options opt;    opt.force = strtobool(cfg->readStringEntry("Force Queries", "true"));  opt.silent = !strtobool(cfg->readStringEntry("Silent", "false"));  opt.use_history_file = strtobool(cfg->readStringEntry("Append Queries to History", "true"));  add_option(&opt.options, cfg, "sql_auto_is_null");  add_option(&opt.options, cfg, "big_tables");  add_option(&opt.options, cfg, "sql_buffer_result");  add_option(&opt.options, cfg, "query_cache_type");  add_option(&opt.options, cfg, "sql_log_off");  add_option(&opt.options, cfg, "sql_quote_show_create");  add_option(&opt.options, cfg, "autocommit");  add_option(&opt.options, cfg, "sql_big_selects");  add_option(&opt.options, cfg, "low_priority_updates");  add_option(&opt.options, cfg, "sql_safe_updates");  add_option(&opt.options, cfg, "sql_log_update");  return opt;}
开发者ID:soundgnome,项目名称:mysqlcc,代码行数:25,


示例2: setDefaultValues

void CQueryWindowOptionsTab::setDefaultValues(CConfig *cfg){  queryNewTab->setChecked(strtobool(cfg->readStringEntry("Query New Tab", "true")));  followQueryTab->setChecked(strtobool(cfg->readStringEntry("Follow Query Tab", "true")));  followResultsTab->setChecked(strtobool(cfg->readStringEntry("Follow Results Tab", "false")));  maxResults->setValue(cfg->readNumberEntry("Max Results to Save", 10));  ((QRadioButton *)multipleQueries->find(cfg->readNumberEntry("Multiple Query Options", 1)))->setChecked(true);}
开发者ID:soundgnome,项目名称:mysqlcc,代码行数:8,


示例3: tool_link_event_write

static ssize_t tool_link_event_write(struct file *filep,				     const char __user *ubuf,				     size_t size, loff_t *offp){	struct tool_ctx *tc = filep->private_data;	char buf[32];	size_t buf_size;	bool val;	int rc;	buf_size = min(size, (sizeof(buf) - 1));	if (copy_from_user(buf, ubuf, buf_size))		return -EFAULT;	buf[buf_size] = '/0';	rc = strtobool(buf, &val);	if (rc)		return rc;	if (wait_event_interruptible(tc->link_wq,		ntb_link_is_up(tc->ntb, NULL, NULL) == val))		return -ERESTART;	return size;}
开发者ID:mdamt,项目名称:linux,代码行数:26,


示例4: tool_link_write

static ssize_t tool_link_write(struct file *filep, const char __user *ubuf,			       size_t size, loff_t *offp){	struct tool_ctx *tc = filep->private_data;	char buf[32];	size_t buf_size;	bool val;	int rc;	buf_size = min(size, (sizeof(buf) - 1));	if (copy_from_user(buf, ubuf, buf_size))		return -EFAULT;	buf[buf_size] = '/0';	rc = strtobool(buf, &val);	if (rc)		return rc;	if (val)		rc = ntb_link_enable(tc->ntb, NTB_SPEED_AUTO, NTB_WIDTH_AUTO);	else		rc = ntb_link_disable(tc->ntb);	if (rc)		return rc;	return size;}
开发者ID:mdamt,项目名称:linux,代码行数:29,


示例5: display_enabled_store

static ssize_t display_enabled_store(struct omap_dss_device *dssdev,		const char *buf, size_t size){	int r;	bool enable;	r = strtobool(buf, &enable);	if (r)		return r;	if (enable == omapdss_device_is_enabled(dssdev))		return size;	if (omapdss_device_is_connected(dssdev) == false)		return -ENODEV;	if (enable) {		r = dssdev->driver->enable(dssdev);		if (r)			return r;	} else {		dssdev->driver->disable(dssdev);	}	return size;}
开发者ID:AK101111,项目名称:linux,代码行数:26,


示例6: iwl_dbgfs_reduced_txp_write

static ssize_t iwl_dbgfs_reduced_txp_write(struct ieee80211_vif *vif,					   char *buf, size_t count,					   loff_t *ppos){	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);	struct iwl_mvm *mvm = mvmvif->mvm;	struct iwl_mvm_sta *mvmsta;	bool reduced_tx_power;	int ret;	if (mvmvif->ap_sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))		return -ENOTCONN;	if (strtobool(buf, &reduced_tx_power) != 0)		return -EINVAL;	mutex_lock(&mvm->mutex);	mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id);	if (IS_ERR_OR_NULL(mvmsta)) {		mutex_unlock(&mvm->mutex);		return -ENOTCONN;	}	mvmsta->bt_reduced_txpower_dbg = false;	ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id,					  reduced_tx_power);	if (!ret)		mvmsta->bt_reduced_txpower_dbg = true;	mutex_unlock(&mvm->mutex);	return ret ? : count;}
开发者ID:alcorjjong,项目名称:ath,代码行数:34,


示例7: usb2_hardware_lpm_store

static ssize_t usb2_hardware_lpm_store(struct device *dev,				       struct device_attribute *attr,				       const char *buf, size_t count){	struct usb_device *udev = to_usb_device(dev);	bool value;	int ret;	ret = usb_lock_device_interruptible(udev);	if (ret < 0)		return -EINTR;	ret = strtobool(buf, &value);	if (!ret) {		udev->usb2_hw_lpm_allowed = value;		if (value)			ret = usb_enable_usb2_hardware_lpm(udev);		else			ret = usb_disable_usb2_hardware_lpm(udev);	}	usb_unlock_device(udev);	if (!ret)		return count;	return ret;}
开发者ID:Anjali05,项目名称:linux,代码行数:29,


示例8: grok_node_flag

static int grok_node_flag(int *flags, const char *key, const char *value){	uint i;	int set, code = -1;	set = strtobool(value);	for (i = 0; i < ARRAY_SIZE(node_config_flags); i++) {		if (!strcasecmp(key, node_config_flags[i].key)) {			code = node_config_flags[i].code;			break;		}	}	if (code == -1) {		return -1;	}	/* set or unset this flag */	if (set) {		*flags |= code;	} else {		*flags = *flags & ~code;	}	return 0;}
开发者ID:ageric,项目名称:merlin,代码行数:26,


示例9: DisplayEnabledWrite

static ssize_t DisplayEnabledWrite(struct file *psFile,				   const char __user *psUserBuffer,				   size_t uiCount,				   loff_t *puiPosition){	IMG_UINT32 *pui32PDPEnabled = psFile->private_data;	char pszBuffer[3];	bool bPDPEnabled;	int iErr;	uiCount = min(uiCount, ARRAY_SIZE(pszBuffer) - 1);	iErr = copy_from_user(pszBuffer, psUserBuffer, uiCount);	if (iErr)	{		return -EFAULT;	}	pszBuffer[uiCount] = '/0';	if (strtobool(pszBuffer, &bPDPEnabled) == 0)	{		*pui32PDPEnabled = bPDPEnabled ? 1 : 0;		DCPDPEnableMemoryRequest(g_psDeviceData, bPDPEnabled);	}	return uiCount;}
开发者ID:STPJ,项目名称:linux-3.4-sunxi,代码行数:29,


示例10: mwifiex_timeshare_coex_write

static ssize_tmwifiex_timeshare_coex_write(struct file *file, const char __user *ubuf,			     size_t count, loff_t *ppos){	bool timeshare_coex;	struct mwifiex_private *priv = file->private_data;	char kbuf[16];	int ret;	if (priv->adapter->fw_api_ver != MWIFIEX_FW_V15)		return -EOPNOTSUPP;	memset(kbuf, 0, sizeof(kbuf));	if (copy_from_user(&kbuf, ubuf, min_t(size_t, sizeof(kbuf) - 1, count)))		return -EFAULT;	if (strtobool(kbuf, &timeshare_coex))		return -EINVAL;	ret = mwifiex_send_cmd(priv, HostCmd_CMD_ROBUST_COEX,			       HostCmd_ACT_GEN_SET, 0, &timeshare_coex, true);	if (ret)		return ret;	else		return count;}
开发者ID:krzk,项目名称:linux,代码行数:27,


示例11: sc_prefetch_write

static ssize_t sc_prefetch_write(struct file *file,				 const char __user *user_buf,				 size_t count, loff_t *ppos){	char buf[32];	ssize_t buf_size;	bool enabled;	int err;	buf_size = min(count, sizeof(buf) - 1);	if (copy_from_user(buf, user_buf, buf_size))		return -EFAULT;	buf[buf_size] = '/0';	err = strtobool(buf, &enabled);	if (err)		return err;	if (enabled)		bc_prefetch_enable();	else		bc_prefetch_disable();	return count;}
开发者ID:12zz,项目名称:linux,代码行数:25,


示例12: set_enable

static int set_enable(const char *arg, const struct kernel_param *kp){	int ret;	bool old_val = *((bool *) kp->arg);	bool new_val;	if (!arg)		arg = "1";	ret = strtobool(arg, &new_val);	if (ret)		return ret;	if (!old_val && new_val) {		if (start_monitoring()) {			pr_err("L2PM counters already in use./n");			return ret;		} else {			pr_info("Enabling CPU BW monitoring/n");		}	} else if (old_val && !new_val) {		pr_info("Disabling CPU BW monitoring/n");		stop_monitoring();	}	*(bool *) kp->arg = new_val;	return 0;}
开发者ID:Cosimo82,项目名称:Fulgor_Kernel_Lollipop,代码行数:27,


示例13: default_configuration

/* Default and user configuration */void default_configuration(configuration_t *config){  char *scan, buffer[MAXLINELEN] ;#define GETINISTRING(key, value) /  GetPrivateProfileString("XFer", (key), (value), buffer, MAXLINELEN, "XFer.ini")  if ( GETINISTRING("comport", "com1:") ) {    if ( (config->comport = strdup(buffer)) == NULL )      error("Out of memory storing comport %s in ini file", buffer) ;  } else /* comport must be set, regardless whether from profile or not */    config->comport = "com1:" ;  if ( GETINISTRING("baudrate", "") ) {    if ( !itobaud(strtol(buffer, &scan, 10), &config->baudrate) || *scan != '/0' )      error("Invalid baud rate %s in ini file", buffer) ;  }  if ( GETINISTRING("timeoutdelay", "") ) {    config->timeoutdelay = strtol(buffer, &scan, 10) ;    if ( *scan != '/0' )      error("Invalid timeout %s in ini file", buffer) ;  }  if ( GETINISTRING("wildcards", "") ) {    if ( !strtobool(buffer, &config->wildcards) )      error("Invalid wildcards flag %s in ini file", buffer) ;  }  if ( GETINISTRING("directories", "") ) {    if ( !strtobool(buffer, &config->directories) )      error("Invalid directories flag %s in ini file", buffer) ;  }  if ( GETINISTRING("handshake", "") ) {    if ( !strtohandshake(buffer, &config->handshake) )      error("Invalid handshake type %s in ini file", buffer) ;  }  if ( GETINISTRING("basic", "") ) {    if ( (config->basic = strdup(buffer)) == NULL )      error("Out of memory storing basic filename %s in ini file", buffer) ;  }}
开发者ID:crtc-demos,项目名称:mode-infinity,代码行数:45,


示例14: grok_db_compound

void grok_db_compound(struct cfg_comp *c){	unsigned int vi;	use_database = 1;	for (vi = 0; vi < c->vars; vi++) {		struct cfg_var *v = c->vlist[vi];		if (!strcmp(v->key, "log_report_data")) {			db_log_reports = strtobool(v->value);		} else if (!prefixcmp(v->key, "log_notification")) {			db_log_notifications = strtobool(v->value);		} else if (!prefixcmp(v->key, "track_current")) {			lwarn("Option '%s' in the database compound is deprecated", v->key);		} else if (!strcmp(v->key, "enabled")) {			use_database = strtobool(v->value);		} else {			sql_config(v->key, v->value);		}	}}
开发者ID:rfelsburg,项目名称:merlin,代码行数:20,


示例15: tfa9890_enable_store

static ssize_t tfa9890_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size){    bool value;    if (strtobool(buf, &value))        return -EINVAL;    if(reset_gpio >0)        gpio_set_value(reset_gpio,((value > 0) ? 1: 0));    pr_debug("Reset the tfa9890.... %d/n",value);    return size;}
开发者ID:youyim,项目名称:Z9Max_NX510J_V1_kernel,代码行数:11,


示例16: early_fsl_a008585_cfg

static int __init early_fsl_a008585_cfg(char *buf){	int ret;	bool val;	ret = strtobool(buf, &val);	if (ret)		return ret;	fsl_a008585_enable = val;	return 0;}
开发者ID:kishore1006,项目名称:linux,代码行数:12,


示例17: read_only_store

static ssize_t read_only_store(struct device *dev,		struct device_attribute *attr, const char *buf, size_t len){	bool ro;	int rc = strtobool(buf, &ro);	struct nd_region *nd_region = to_nd_region(dev);	if (rc)		return rc;	nd_region->ro = ro;	return len;}
开发者ID:Chong-Li,项目名称:cse522,代码行数:13,


示例18: write_file_tx99

static ssize_t write_file_tx99(struct file *file, const char __user *user_buf,			       size_t count, loff_t *ppos){	struct ath_softc *sc = file->private_data;	struct ath_common *common = ath9k_hw_common(sc->sc_ah);	char buf[32];	bool start;	ssize_t len;	int r;	if (count < 1)		return -EINVAL;	if (sc->cur_chan->nvifs > 1)		return -EOPNOTSUPP;	len = min(count, sizeof(buf) - 1);	if (copy_from_user(buf, user_buf, len))		return -EFAULT;	buf[len] = '/0';	if (strtobool(buf, &start))		return -EINVAL;	mutex_lock(&sc->mutex);	if (start == sc->tx99_state) {		if (!start)			goto out;		ath_dbg(common, XMIT, "Resetting TX99/n");		ath9k_tx99_deinit(sc);	}	if (!start) {		ath9k_tx99_deinit(sc);		goto out;	}	r = ath9k_tx99_init(sc);	if (r) {		mutex_unlock(&sc->mutex);		return r;	}out:	mutex_unlock(&sc->mutex);	return count;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:48,


示例19: interface_authorized_store

/* * interface_authorized_store - authorize or deauthorize an USB interface */static ssize_t interface_authorized_store(struct device *dev,		struct device_attribute *attr, const char *buf, size_t count){	struct usb_interface *intf = to_usb_interface(dev);	bool val;	if (strtobool(buf, &val) != 0)		return -EINVAL;	if (val)		usb_authorize_interface(intf);	else		usb_deauthorize_interface(intf);	return count;}
开发者ID:Anjali05,项目名称:linux,代码行数:19,


示例20: hall_device_enable_store

static ssize_t hall_device_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size){	struct hall_device_chip *chip = dev_get_drvdata(dev);	bool value;	if (strtobool(buf, &value))		return -EINVAL;    mutex_lock(&chip->lock);    chip->enabled = (value>0) ? true : false;    hall_device_enable(chip, chip->enabled);    mutex_unlock(&chip->lock);	return size;}
开发者ID:98416,项目名称:Z7Max_NX505J_H129_kernel,代码行数:16,


示例21: xen_parse_512gb

static void __init xen_parse_512gb(void){	bool val = false;	char *arg;	arg = strstr(xen_start_info->cmd_line, "xen_512gb_limit");	if (!arg)		return;	arg = strstr(xen_start_info->cmd_line, "xen_512gb_limit=");	if (!arg)		val = true;	else if (strtobool(arg + strlen("xen_512gb_limit="), &val))		return;	xen_512gb_limit = val;}
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:17,


示例22: write_file_bool

static ssize_t write_file_bool(struct file *file, const char __user *user_buf,			       size_t count, loff_t *ppos){	char buf[32];	size_t buf_size;	bool bv;	u32 *val = file->private_data;	buf_size = min(count, (sizeof(buf)-1));	if (copy_from_user(buf, user_buf, buf_size))		return -EFAULT;	if (strtobool(buf, &bv) == 0)		*val = bv;	return count;}
开发者ID:Apaisal,项目名称:linux,代码行数:17,


示例23: Factory_UMIP_store

ssize_t Factory_UMIP_store(struct device *dev,					struct device_attribute *attr,					const char *buffer, size_t count){	int ret = 0;	u8 data_write;	u8 yes;	u8 no;	bool bv;	if (strlen(buffer) != 2) {		pr_err("The length must be 1/n");		ret = -EINVAL;		goto error;	}	ret = strtobool(buffer, &bv);	if (ret) {		pr_err("Not expected value [Y|y|1|N|n|0]/n");		goto error;	}	if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_PENWELL) {		ret = intel_scu_ipc_read_mip(&data_write,						1,						FACTORY_UMIP_OFFSET,						0);		data_write &= ~(1 << FACTORY_BIT_OFFSET);		data_write |= bv;		ret = intel_scu_ipc_write_umip(&data_write,						1,						FACTORY_UMIP_OFFSET);		if (ret) {			pr_err("Could not write to UMIP for Factory/n");			goto error;		}	}	return count;error:	return ret;}
开发者ID:kamarush,项目名称:ZTE_GXIn_Kernel-3.0.8,代码行数:45,


示例24: display_mirror_store

static ssize_t display_mirror_store(struct omap_dss_device *dssdev,	const char *buf, size_t size){	int r;	bool mirror;	if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror)		return -ENOENT;	r = strtobool(buf, &mirror);	if (r)		return r;	r = dssdev->driver->set_mirror(dssdev, mirror);	if (r)		return r;	return size;}
开发者ID:AK101111,项目名称:linux,代码行数:19,


示例25: raw_ip_store

static ssize_t raw_ip_store(struct device *d,  struct device_attribute *attr, const char *buf, size_t len){	struct usbnet *dev = netdev_priv(to_net_dev(d));	struct qmi_wwan_state *info = (void *)&dev->data;	bool enable;	int ret;	if (strtobool(buf, &enable))		return -EINVAL;	/* no change? */	if (enable == (info->flags & QMI_WWAN_FLAG_RAWIP))		return len;	if (!rtnl_trylock())		return restart_syscall();	/* we don't want to modify a running netdev */	if (netif_running(dev->net)) {		netdev_err(dev->net, "Cannot change a running device/n");		ret = -EBUSY;		goto err;	}	/* let other drivers deny the change */	ret = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, dev->net);	ret = notifier_to_errno(ret);	if (ret) {		netdev_err(dev->net, "Type change was refused/n");		goto err;	}	if (enable)		info->flags |= QMI_WWAN_FLAG_RAWIP;	else		info->flags &= ~QMI_WWAN_FLAG_RAWIP;	qmi_wwan_netdev_setup(dev->net);	call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev->net);	ret = len;err:	rtnl_unlock();	return ret;}
开发者ID:020gzh,项目名称:linux,代码行数:43,


示例26: compass_int_pin_set

static ssize_t compass_int_pin_set(struct device *dev, struct device_attribute *attr, const char *buf, size_t size){    bool value;    if (strtobool(buf, &value))        return -EINVAL;    if (value)    {         SENSOR_LOG_INFO("set to be 1/n");        gpio_set_value(COMPASS_INT_PIN, 1);    }    else    {        SENSOR_LOG_INFO("set to be 0/n");        gpio_set_value(COMPASS_INT_PIN, 0);    }    return size;}
开发者ID:jaydenhe,项目名称:X6_NX601_kernel,代码行数:19,


示例27: ad7152_start_calib

static inline ssize_t ad7152_start_calib(struct device *dev,        struct device_attribute *attr,        const char *buf,        size_t len,        u8 regval){    struct iio_dev *indio_dev = dev_to_iio_dev(dev);    struct ad7152_chip_info *chip = iio_priv(indio_dev);    struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);    bool doit;    int ret, timeout = 10;    ret = strtobool(buf, &doit);    if (ret < 0)        return ret;    if (!doit)        return 0;    if (this_attr->address == 0)        regval |= AD7152_CONF_CH1EN;    else        regval |= AD7152_CONF_CH2EN;    mutex_lock(&indio_dev->mlock);    ret = i2c_smbus_write_byte_data(chip->client, AD7152_REG_CFG, regval);    if (ret < 0) {        mutex_unlock(&indio_dev->mlock);        return ret;    }    do {        mdelay(20);        ret = i2c_smbus_read_byte_data(chip->client, AD7152_REG_CFG);        if (ret < 0) {            mutex_unlock(&indio_dev->mlock);            return ret;        }    } while ((ret == regval) && timeout--);    mutex_unlock(&indio_dev->mlock);    return len;}
开发者ID:markosilla,项目名称:linux-raspberry,代码行数:43,


示例28: display_tear_store

static ssize_t display_tear_store(struct omap_dss_device *dssdev,	const char *buf, size_t size){	int r;	bool te;	if (!dssdev->driver->enable_te || !dssdev->driver->get_te)		return -ENOENT;	r = strtobool(buf, &te);	if (r)		return r;	r = dssdev->driver->enable_te(dssdev, te);	if (r)		return r;	return size;}
开发者ID:AK101111,项目名称:linux,代码行数:19,


示例29: param_set_bool

/* Actually could be a bool or an int, for historical reasons. */int param_set_bool(const char *val, const struct kernel_param *kp){	bool v;	int ret;	/* No equals means "set"... */	if (!val) val = "1";	/* One of =[yYnN01] */	ret = strtobool(val, &v);	if (ret)		return ret;	if (kp->flags & KPARAM_ISBOOL)		*(bool *)kp->arg = v;	else		*(int *)kp->arg = v;	return 0;}
开发者ID:locosoft1986,项目名称:nucleos,代码行数:20,



注:本文中的strtobool函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ strtod函数代码示例
C++ strstrip函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。