• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setname函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: START_TEST

END_TEST

START_TEST(test_setname)
{
    char *good_name = "consensualCorn";
    int good_length = strlen(good_name);
    int bad_length = REALLY_BIG_NUMBER;

    if(setname((uint8_t *)good_name, bad_length) != -1)
        ck_abort_msg("setname() did NOT error on %d as a length argument!\n",
                                                                bad_length);
    if(setname((uint8_t *)good_name, good_length) != 0)
        ck_abort_msg("setname() did NOT return 0 on good arguments!\n");
}
开发者ID:1h6,项目名称:ProjectTox-Core,代码行数:14,代码来源:messenger_test.c


示例2: pexerr

static void
pexerr(void)
{
    /* Couldn't find the damn thing */
    if (expath) {
	setname(vis_str(expath));
	Vexpath = 0;
	xfree(expath);
	expath = 0;
    }
    else
	setname("");
    if (exerr)
	stderror(ERR_NAME | ERR_STRING, exerr);
    stderror(ERR_NAME | ERR_COMMAND);
}
开发者ID:radixo,项目名称:openbsd-src,代码行数:16,代码来源:exec.c


示例3: setname

void
human::fromstring(string & data){

	string 
	S;

	stringcopier::copy(S, data);

	vector < string > 
	V = stringcopier::split("\t", S);

	if (V.size() < 3){

		errorstate::error = "human::fromstring - error 1: out of data";
		errorstate::code = 1;

		return;

	}

	// name, first_name, fathers_name

	setname(V[0]);
	setfirst_name(V[1]);
	setfathers_name(V[2]);

}
开发者ID:waterlink,项目名称:tspp_project,代码行数:27,代码来源:human.cpp


示例4: MCValueRetain

Boolean MCEPS::import(MCStringRef fname, IO_handle stream)
{
	size = (uint4)MCS_fsize(stream);
	delete postscript;
	postscript = new char[size + 1];
	if (IO_read(postscript, size, stream) != IO_NORMAL)
		return False;
	postscript[size] = '\0';
	uindex_t t_sep;
    MCStringRef t_fname;
    if (MCStringLastIndexOfChar(fname, PATH_SEPARATOR, UINDEX_MAX, kMCCompareExact, t_sep))
        /* UNCHECKED */ MCStringCopySubstring(fname, MCRangeMake(t_sep + 1, MCStringGetLength(fname) - (t_sep + 1)), t_fname);
    else
        t_fname = MCValueRetain(fname);
    
    MCNewAutoNameRef t_name;
    if (!MCNameCreateAndRelease(t_fname, &t_name))
        return False;
    setname(*t_name);
	setextents();
	rect.width = (uint2)(ex * xscale / xf);
	rect.height = (uint2)(ey * yscale / yf);
	if (flags & F_SHOW_BORDER)
	{
		rect.width += borderwidth << 1;
		rect.height += borderwidth << 1;
	}
	return True;
}
开发者ID:alilloyd,项目名称:livecode,代码行数:29,代码来源:eps.cpp


示例5: setpfad

int plotter::plot(std::function<double(double)> function, std::string pfad, std::string name, double schritte)
{
  setpfad(pfad);
  setname(name);
  setschritte(schritte);
  return plot(function);
}
开发者ID:nMerlin,项目名称:CP,代码行数:7,代码来源:plotter.cpp


示例6: setname

int CommandListener::SetBufSizeCmd::runCommand(SocketClient *cli,
                                         int argc, char **argv) {
    setname();
    if (!clientHasLogCredentials(cli)) {
        cli->sendMsg("Permission Denied");
        return 0;
    }

    if (argc < 3) {
        cli->sendMsg("Missing Argument");
        return 0;
    }

    int id = atoi(argv[1]);
    if ((id < LOG_ID_MIN) || (LOG_ID_MAX <= id)) {
        cli->sendMsg("Range Error");
        return 0;
    }

    unsigned long size = atol(argv[2]);
    if (mBuf.setSize((log_id_t) id, size)) {
        cli->sendMsg("Range Error");
        return 0;
    }

    cli->sendMsg("success");
    return 0;
}
开发者ID:AsteroidOS,项目名称:android_system_core,代码行数:28,代码来源:CommandListener.cpp


示例7: execute

void execute(ToxWindow *self, ChatContext *ctx, char *cmd)
{
  if (!strcmp(cmd, "/clear") || !strcmp(cmd, "/c")) {
    wclear(self->window);
    wclear(ctx->history);
  }

  else if (!strcmp(cmd, "/help") || !strcmp(cmd, "/h"))
    print_help(ctx);

  else if (!strcmp(cmd, "/quit") || !strcmp(cmd, "/exit") || !strcmp(cmd, "/q")) {
    endwin();
    exit(0);
  }

  else if (!strncmp(cmd, "/status ", strlen("/status "))) {
    char *msg;
    msg = strchr(cmd, ' ');
    if (msg == NULL) {
      wprintw(ctx->history, "Invalid syntax.\n");
      return;
    }
    msg++;
    m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1);
    wprintw(ctx->history, "Status set to: %s\n", msg);
  }

  else if (!strncmp(cmd, "/nick ", strlen("/nick "))) {
    char *nick;
    nick = strchr(cmd, ' ');
    if (nick == NULL) {
      wprintw(ctx->history, "Invalid syntax.\n");
      return;
    }
    nick++;
    setname((uint8_t*) nick, strlen(nick)+1);
    wprintw(ctx->history, "Nickname set to: %s\n", nick);
  }

  else if (!strcmp(cmd, "/myid")) {
    char id[32*2 + 1] = {0};
    int i;
    for (i = 0; i < 32; i++) {
      char xx[3];
      snprintf(xx, sizeof(xx), "%02x",  self_public_key[i] & 0xff);
      strcat(id, xx);
    }
    wprintw(ctx->history, "Your ID: %s\n", id);
  }

  else if (strcmp(ctx->line, "/close") == 0) {
    active_window = 0;    // Go to prompt screen
    int f_num = ctx->friendnum;
    delwin(ctx->linewin);
    del_window(self, f_num);
  }

  else
    wprintw(ctx->history, "Invalid command.\n");
}
开发者ID:ghacnt,项目名称:ProjectTox-Core,代码行数:60,代码来源:chat.c


示例8: udvar

void
udvar(Char *name)
{
    setname(vis_str(name));
    stderror(ERR_NAME | ERR_UNDVAR);
    /* NOTREACHED */
}
开发者ID:IIJ-NetBSD,项目名称:netbsd-src,代码行数:7,代码来源:misc.c


示例9: handleone

static Char *
handleone(Char *str, Char **vl, int action)
{
    size_t chars;
    Char **t, *p, *strp;

    switch (action) {
    case G_ERROR:
	setname(short2str(str));
	blkfree(vl);
	stderror(ERR_NAME | ERR_AMBIG);
	break;
    case G_APPEND:
	chars = 0;
	for (t = vl; (p = *t++) != NULL; chars++)
	    chars += Strlen(p);
	str = xmalloc(chars * sizeof(Char));
	for (t = vl, strp = str; (p = *t++) != '\0'; chars++) {
	    while (*p)
		 *strp++ = *p++ & TRIM;
	    *strp++ = ' ';
	}
	*--strp = '\0';
	blkfree(vl);
	break;
    case G_IGNORE:
	str = Strsave(strip(*vl));
	blkfree(vl);
	break;
    default:
	break;
    }
    return (str);
}
开发者ID:2014-class,项目名称:freerouter,代码行数:34,代码来源:sh.glob.c


示例10: change_nickname

void change_nickname()
{
    uint8_t name[MAX_NAME_LENGTH];
    int i = 0;
    size_t len = strlen(line);
    
    for (i = 3; i < len; i++) {

        if (line[i] == 0 || line[i] == '\n')
            break;

        name[i-3] = line[i];
    }
    
    name[i-3] = 0;
    setname(name, i);
    char numstring[100];
    sprintf(numstring, "\n[i] changed nick to %s\n\n", (char*)name);
    printf(numstring);

    FILE *name_file = NULL;
    name_file = fopen("namefile.txt", "w");
    fprintf(name_file, "%s", (char*)name);
    fclose(name_file);
}
开发者ID:sodwalt,项目名称:ProjectTox-Core,代码行数:25,代码来源:nTox_win32.c


示例11: START_TEST

END_TEST
/*
START_TEST(test_m_addfriend)
{
    char *good_data = "test";
    char *bad_data = "";

    int good_len = strlen(good_data);
    int bad_len = strlen(bad_data);
    int really_bad_len = (MAX_CRYPTO_PACKET_SIZE - crypto_box_PUBLICKEYBYTES
                     - crypto_box_NONCEBYTES - crypto_box_BOXZEROBYTES
                                      + crypto_box_ZEROBYTES + 100); */
/* TODO: Update this properly to latest master
    if(m_addfriend(m, (uint8_t *)friend_id, (uint8_t *)good_data, really_bad_len) != FAERR_TOOLONG)
        ck_abort_msg("m_addfriend did NOT catch the following length: %d\n", really_bad_len);
*/
/* this will error if the original m_addfriend_norequest() failed */
/*    if(m_addfriend(m, (uint8_t *)friend_id, (uint8_t *)good_data, good_len) != FAERR_ALREADYSENT)
        ck_abort_msg("m_addfriend did NOT catch adding a friend we already have.\n"
                     "(this can be caused by the error of m_addfriend_norequest in"
                     " the beginning of the suite)\n");

    if(m_addfriend(m, (uint8_t *)good_id_b, (uint8_t *)bad_data, bad_len) != FAERR_NOMESSAGE)
        ck_abort_msg("m_addfriend did NOT catch the following length: %d\n", bad_len);
*/
/* this should REALLY error */
/*
 * TODO: validate client_id in m_addfriend?
if(m_addfriend((uint8_t *)bad_id, (uint8_t *)good_data, good_len) >= 0)
    ck_abort_msg("The following ID passed through "
          "m_addfriend without an error:\n'%s'\n", bad_id_str);

}
END_TEST */

START_TEST(test_setname)
{
    char *good_name = "consensualCorn";
    int good_length = strlen(good_name);
    int bad_length = REALLY_BIG_NUMBER;

    ck_assert_msg((setname(m, (uint8_t *)good_name, bad_length) == -1),
                  "setname() did NOT error on %d as a length argument!\n", bad_length);

    ck_assert_msg((setname(m, (uint8_t *)good_name, good_length) == 0),
                  "setname() did NOT return 0 on good arguments!\n");
}
开发者ID:13693100472,项目名称:toxcore,代码行数:47,代码来源:messenger_test.c


示例12: EchoTC

/*
 * Print the termcap string out with variable substitution
 */
	void
EchoTC(Char **v)
{
	Char **globbed;
	char    cv[BUFSIZE];/*FIXBUF*/
	int     verbose = 0, silent = 0;
	static char *fmts = "%s\n", *fmtd = "%d\n";
	int li,co;


	setname("echotc");

	v = glob_all_or_error(v);
	globbed = v;
	cleanup_push(globbed, blk_cleanup);

	if (!v || !*v || *v[0] == '\0')
		goto end;
	if (v[0][0] == '-') {
		switch (v[0][1]) {
			case 'v':
				verbose = 1;
				break;
			case 's':
				silent = 1;
				break;
			default:
				stderror(ERR_NAME | ERR_TCUSAGE);
				break;
		}
		v++;
	}
	if (!*v || *v[0] == '\0')
		goto end;
	(void) StringCbCopy(cv,sizeof(cv), short2str(*v));

	GetSize(&li,&co);

	if(!lstrcmp(cv,"rows") || !lstrcmp(cv,"lines") ) {
		xprintf(fmtd,T_Lines);
		goto end;
	}
	else if(!lstrcmp(cv,"cols") ) {
		xprintf(fmtd,T_ActualWindowSize);
		goto end;
	}
	else if(!lstrcmp(cv,"buffer") ) {
		xprintf(fmtd,T_Cols);
		goto end;
	}
	else
		stderror(ERR_SYSTEM, "EchoTC","Sorry, this function is not supported");

end:
	cleanup_until(globbed);
}
开发者ID:Lance0312,项目名称:tcsh,代码行数:59,代码来源:nt.screen.c


示例13: ipush

static void
ipush(Istack *is)
{
	if(istack == nil)
		ibottom = is;
	else
		is->next = istack;
	istack = is;
	setname();
}
开发者ID:00001,项目名称:plan9port,代码行数:10,代码来源:input.c


示例14: cmd_nick

void cmd_nick(ToxWindow *self, Messenger *m, char **args)
{
    char *nick = args[1];
    setname(m, (uint8_t *) nick, strlen(nick) + 1);
    wprintw(self->window, "Nickname set to: %s\n", nick);

    if (store_data(m, DATA_FILE)) {
        wprintw(self->window, "\nCould not store Messenger data\n");
    }
}
开发者ID:notadecent,项目名称:toxic,代码行数:10,代码来源:prompt.c


示例15: iqueue

static void
iqueue(Istack *is)
{
	if(ibottom == nil){
		istack = is;
		setname();
	}else
		ibottom->next = is;
	ibottom = is;
}
开发者ID:00001,项目名称:plan9port,代码行数:10,代码来源:input.c


示例16: qt_static_metacall

int MealModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 3)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 3;
    }
#ifndef QT_NO_PROPERTIES
    else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0:
            *reinterpret_cast< QString*>(_v) = type();
            break;
        case 1:
            *reinterpret_cast< QString*>(_v) = name();
            break;
        case 2:
            *reinterpret_cast< QString*>(_v) = price();
            break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0:
            settype(*reinterpret_cast< QString*>(_v));
            break;
        case 1:
            setname(*reinterpret_cast< QString*>(_v));
            break;
        case 2:
            setprice(*reinterpret_cast< QString*>(_v));
            break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 3;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
开发者ID:BenedicteGiraud,项目名称:ProjetINFSI351,代码行数:55,代码来源:moc_MealModel.cpp


示例17: newclosure

/* newclosure - allocate and initialize a new closure */
LVAL newclosure(LVAL name, LVAL type, LVAL env, LVAL fenv)
{
    LVAL val;
    val = newvector(CLOSIZE);
    val->n_type = CLOSURE;
    setname(val,name);
    settype(val,type);
    setenv(val,env);
    setfenv(val,fenv);
    return (val);
}
开发者ID:andreipaga,项目名称:audacity,代码行数:12,代码来源:xldmem.c


示例18: tox_set_name

/* Set our nickname.
 * name must be a string of maximum MAX_NAME_LENGTH length.
 * length must be at least 1 byte.
 * length is the length of name with the NULL terminator.
 *
 *  return 0 if success.
 *  return -1 if failure.
 */
int tox_set_name(Tox *tox, const uint8_t *name, uint16_t length)
{
    Messenger *m = tox;

    if (setname(m, name, length) == 0) {
        send_name_all_groups(m->group_chat_object);
        return 0;
    } else {
        return -1;
    }
}
开发者ID:CharlyEtu,项目名称:toxcore,代码行数:19,代码来源:tox.c


示例19: atoi

table::table() {
	m_xhost = m_config.at("lollipop.db.host");
	m_xusername = m_config.at("lollipop.db.user");
	m_xpassword = m_config.at("lollipop.db.password");
	m_xdbname = m_config.at("lollipop.db.dbname");
	m_xtablename = NULL;
	m_datafile = m_config.at("lollipop.db.datafile", NULL); // TODO: save data to file on errors
	m_sqlout = atoi(m_config.at("lollipop.db.logsql", "0"));
	m_debugmode = atoi(m_config.at("lollipop.db.debug", "0"));
	setname("DEFAULT_TABLE_NAME");
}
开发者ID:robacklin,项目名称:tidalwave,代码行数:11,代码来源:table.cpp


示例20: init_tox

static Messenger * init_tox()
{
  /* Init core */
  Messenger *m = initMessenger();

  /* Callbacks */
  m_callback_friendrequest(m, on_request, NULL);
  m_callback_friendmessage(m, on_message, NULL);
  m_callback_namechange(m, on_nickchange, NULL);
  m_callback_statusmessage(m, on_statuschange, NULL);
  m_callback_action(m, on_action, NULL);
#ifdef __linux__
  setname(m, (uint8_t*) "Cool guy", sizeof("Cool guy"));
#elif WIN32
  setname(m, (uint8_t*) "I should install GNU/Linux", sizeof("I should install GNU/Linux"));
#else
  setname(m, (uint8_t*) "Hipster", sizeof("Hipster"));
#endif
  return m;
}
开发者ID:proxypoke,项目名称:ProjectTox-Core,代码行数:20,代码来源:main.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setnilvalue函数代码示例发布时间:2022-05-30
下一篇:
C++ setmsg_函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap