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

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

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

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

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

示例1: main

int main(void) {	int i, j;	char s[MAXLEN], t[MAXLEN];		/* input strings */	s[0] = t[0] = ' ';	scanf("%s", &(s[1])); scanf("%s", &(t[1]));	printf("matching cost = %d /n", string_compare(s, t));	print_matrix(s, t, TRUE);	printf("/n");	print_matrix(s, t, FALSE);	goal_cell(s, t, &i, &j); printf("%d %d/n", i, j);	reconstruct_path(s,t, i ,j); printf("/n");		return 0;}
开发者ID:armenr,项目名称:algorist,代码行数:15,


示例2: funcname_to_pc

struct inst *funcname_to_pc(dbref program, const char *name){    int i, siz;    struct inst *code;    code = DBFETCH(program)->sp.program.code;    siz = DBFETCH(program)->sp.program.siz;    for (i = 0; i < siz; i++) {        if ((code[i].type == PROG_FUNCTION) &&                !string_compare(name, code[i].data.string->data)) {            return (code + i);        }    }    return(NULL);}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:15,


示例3: sort_strings

void sort_strings (char** in, char** out) {    int in_index = 0;    while (in[in_index] != NULL) {        char* in_string = in[in_index++];        int out_index = 0;        while (out[out_index] != NULL) {            char* out_string = out[out_index];            printf("%s, %s/n", in_string, out_string);            if (string_compare(in_string, out_string))                insert (out, in_string, out_index);            else                 out_index++;        }    }}
开发者ID:ionathanch,项目名称:projecteuler,代码行数:15,


示例4: prim_cancallp

voidprim_cancallp(PRIM_PROTOTYPE){	CHECKOP(2);	oper2 = POP();				/* string: public function name */	oper1 = POP();				/* dbref: Program dbref to check */	if (oper1->type != PROG_OBJECT)		abort_interp("Expected dbref argument. (1)");	if (!valid_object(oper1))		abort_interp("Invalid dbref (1)");	if (Typeof(oper1->data.objref) != TYPE_PROGRAM)		abort_interp("Object is not a MUF Program. (1)");	if (oper2->type != PROG_STRING)		abort_interp("Expected string argument. (2)");	if (!oper2->data.string)		abort_interp("Invalid Null string argument. (2)");	if (!(PROGRAM_CODE(oper1->data.objref))) {		struct line *tmpline;		tmpline = PROGRAM_FIRST(oper1->data.objref);		PROGRAM_SET_FIRST(oper1->data.objref,						  (struct line *) read_program(oper1->data.objref));		do_compile(-1, OWNER(oper1->data.objref), oper1->data.objref, 0);		free_prog_text(PROGRAM_FIRST(oper1->data.objref));		PROGRAM_SET_FIRST(oper1->data.objref, tmpline);	}	result = 0;	if (ProgMLevel(oper1->data.objref) > 0 &&		(mlev >= 4 || OWNER(oper1->data.objref) == ProgUID || Linkable(oper1->data.objref))			) {		struct publics *pbs;		pbs = PROGRAM_PUBS(oper1->data.objref);		while (pbs) {			if (!string_compare(oper2->data.string->data, pbs->subname))				break;			pbs = pbs->next;		}		if (pbs && mlev >= pbs->mlev)			result = 1;	}	CHECKOFLOW(1);	CLEAR(oper1);	CLEAR(oper2);	PushInt(result);}
开发者ID:hyena,项目名称:fuzzball,代码行数:48,


示例5: Probe_volfree

/* Probe_volfree */uint32_t Probe_volfree(Probe * probe, AppServerClient * asc,		String const * volume){	unsigned int i;	for(i = 0; i < probe->volinfo_cnt			&& string_compare(probe->volinfo[i].name, volume) != 0;			i++);	if(i == probe->volinfo_cnt)		return -1;#if defined(DEBUG)	fprintf(stderr, "%s() %s %lu/n", __func__, probe->volinfo[i].name,			probe->volinfo[i].free);#endif	return probe->volinfo[i].free * (probe->volinfo[i].block_size / 1024);}
开发者ID:DeforaOS,项目名称:Probe,代码行数:17,


示例6: find_process_by_name

/* *  Given the name of a process, find its PCB entry  */PROCESS find_process_by_name (char* name) {   PROCESS this_process = NULL;    //find the process in the PCB array   int i;   for (i = 0; i < MAX_PROCS; i++)    {      if (string_compare(pcb[i].name, name) )      {         this_process = &pcb[i];         break;       }   }   return this_process; }
开发者ID:AbhijitParate,项目名称:TOS,代码行数:19,


示例7: do_debug

static int do_debug(char *arg){	int result;	arg = wdog_get_loglevel();	if (string_compare("notice", arg))		arg = "debug";	else		arg = "notice";	result = wdog_set_loglevel(arg);	if (verbose)		printf("loglevel: %s/n", wdog_get_loglevel());	return result;}
开发者ID:troglobit,项目名称:watchdogd,代码行数:16,


示例8: macro_expansion

char *macro_expansion(struct macrotable *node, const char *match){	if (!node)		return NULL;	else {		register int value = string_compare(match, node->name);		if (value < 0)			return macro_expansion(node->left, match);		else if (value > 0)			return macro_expansion(node->right, match);		else			return alloc_string(node->definition);	}}
开发者ID:PyroMuddypaw,项目名称:fuzzball,代码行数:16,


示例9: atomic_hash_table_update_one_file

static int atomic_hash_table_update_one_file(english_word *word){  uint64_t hashv=fnv_hash(word->str,word->len);  uint64_t index=hashv%global_hash_table_size;  //this next line results in a lot of cache misses  //for obvious reasons  if(!global_hash_table[index]){//word isn't in the hash table, add it    uint8_t *mem=xmalloc(word->len);    word->str=(char*)my_strcpy(mem,(uint8_t*)word->str,word->len);    void *prev=global_hash_table[index];    int test=atomic_compare_exchange_n(global_hash_table+index,&prev,word);    if(test){      //we added the word      //this needs to be atomic to prevent two threads writing different      //values to the same index of indices      uint64_t old_indices_index=atomic_fetch_add(&indices_index,1);      //this doesn't need to be atomic, since indices_index will never be      //decremented, so no one else will change this      hash_table_indices[old_indices_index]=index;      goto end1;    }    //else, someone else changed the value of global_hash_table[index] before us  }  while(1){    do {      //see if the value in the table is the same as our value      //if so update the value already in the table      if(string_compare(global_hash_table[index],word)){        //atomically increment word count        atomic_add(&global_hash_table[index]->count,1);        goto end0;      }    } while(global_hash_table[++index]);    //not in the table use next free index (if we can)    void *prev=global_hash_table[index];    int test=atomic_compare_exchange_n(global_hash_table+index,&prev,word);    if(test){      uint64_t old_indices_index=atomic_fetch_add(&indices_index,1);      hash_table_indices[old_indices_index]=index;      goto end1;    }    //if !test the compare exchange failed and we need to keep looping  } end0:  return 0; end1:  return 1;}
开发者ID:hitchiker42,项目名称:my-code,代码行数:47,


示例10: tuple_compare_string

static int tuple_compare_string (const Tuple * a, const Tuple * b, int field){    char * string_a = tuple_get_str (a, field, NULL);    char * string_b = tuple_get_str (b, field, NULL);    int ret;    if (string_a == NULL)        ret = (string_b == NULL) ? 0 : -1;    else if (string_b == NULL)        ret = 1;    else        ret = string_compare (string_a, string_b);    str_unref (string_a);    str_unref (string_b);    return ret;}
开发者ID:suaff,项目名称:audacious,代码行数:17,


示例11: skill_lookup

int skill_lookup(char *skill) {	if (string_is_numeric(skill)) {		int d;		sscanf(skill, "%i", &d);		return d;	} else {		int i;		for (i = 0; i < n_skills; i++) {			if (string_compare((char *) skills[i], skill, FALSE)) {				return i;			}		}		return -1;	}}
开发者ID:Bigorneau,项目名称:motoko,代码行数:17,


示例12: get_word

static struct word *__search_cat_word(const struct cat_node *node, const struct string *word){	struct rbtree_node *n;	struct word *w;	int res;	for (n = node->words.node; n != NULL; ) {		w = get_word(n);		if ((res = string_compare(word, &w->name)) < 0) {			n = n->left;		} else if (res > 0) {			n = n->right;		} else {			return w;		}	}	return NULL;}
开发者ID:lasyard,项目名称:HomeAccount,代码行数:17,


示例13: req_forward_all_local_racks

static voidreq_forward_all_local_racks(struct context *ctx, struct conn *c_conn,                            struct msg *msg, struct mbuf *orig_mbuf,                            uint8_t *key, uint32_t keylen, struct datacenter *dc){    //log_debug(LOG_DEBUG, "dc name  '%.*s'",    //            dc->name->len, dc->name->data);    uint8_t rack_cnt = (uint8_t)array_n(&dc->racks);    uint8_t rack_index;    msg->rsp_handler = msg_get_rsp_handler(msg);    init_response_mgr(&msg->rspmgr, msg, msg->is_read, rack_cnt, c_conn);    log_info("msg %d:%d same DC racks:%d expect replies %d",             msg->id, msg->parent_id, rack_cnt, msg->rspmgr.max_responses);    for(rack_index = 0; rack_index < rack_cnt; rack_index++) {        struct rack *rack = array_get(&dc->racks, rack_index);        //log_debug(LOG_DEBUG, "rack name '%.*s'",        //            rack->name->len, rack->name->data);        struct msg *rack_msg;        // clone message even for local node        struct server_pool *pool = c_conn->owner;        if (string_compare(rack->name, &pool->rack) == 0 ) {            rack_msg = msg;        } else {            rack_msg = msg_get(c_conn, msg->request, __FUNCTION__);            if (rack_msg == NULL) {                log_debug(LOG_VERB, "whelp, looks like yer screwed "                        "now, buddy. no inter-rack messages for "                        "you!");                continue;            }            msg_clone(msg, orig_mbuf, rack_msg);            log_info("msg (%d:%d) clone to rack msg (%d:%d)",                     msg->id, msg->parent_id, rack_msg->id, rack_msg->parent_id);            rack_msg->swallow = true;        }        if (log_loggable(LOG_DEBUG)) {            log_debug(LOG_DEBUG, "forwarding request to conn '%s' on rack '%.*s'",                    dn_unresolve_peer_desc(c_conn->sd), rack->name->len, rack->name->data);        }        log_debug(LOG_VERB, "c_conn: %p forwarding (%d:%d)",                c_conn, rack_msg->id, rack_msg->parent_id);        remote_req_forward(ctx, c_conn, rack_msg, rack, key, keylen);    }}
开发者ID:Netflix,项目名称:dynomite,代码行数:46,


示例14: muf_dlog_remove

voidmuf_dlog_remove(struct frame *fr, const char *dlogid){	struct dlogidlist **prev = &fr->dlogids;	while (*prev) {		if (!string_compare(dlogid, (*prev)->dlogid)) {			struct dlogidlist *tmp = *prev;			*prev = (*prev)->next;			free(tmp);		} else {			prev = &((*prev)->next);		}	}	GuiFree(dlogid);}
开发者ID:PyroMuddypaw,项目名称:fuzzball,代码行数:17,


示例15: hash

/* this function will return the value of an indexed hash */char *ht_get(HashTable *hashtable, const char *key){        List *list_ptr;        unsigned int index;        /* retrieve the index using the hash function */        index = hash(key, hashtable->size);        /* affect the pointer to the first node in the list with the given index of the hash table array */        list_ptr = hashtable->array[index];        /* while the node in the list is not NULL traverse the list till we find the requested key */        while(list_ptr != NULL) {                if(string_compare(list_ptr->key, key) == 0) {                        return (strdup(list_ptr->value));                }                list_ptr = list_ptr->next;        }        return "NULL";}
开发者ID:DamianAli,项目名称:holbertonschool-low_level_programming,代码行数:18,


示例16: context_add_function

/* add a function to a context */int context_add_function(context_t *cont, function_t *func){	function_t *check_func = NULL;	context_lock(cont);	if (func->name != NULL) {		/* this is a function with a name */		check_func = LIST_TO_STRUCT(function_t, list, cont->funcs.next);		/* check that we don't have this function's name already */		while (check_func != NULL) {			if (!string_compare(check_func->name, func->name)) {				context_unlock(cont);				ERROR(-ERROR_FEXIST);			}			check_func = LIST_TO_STRUCT(function_t, list, check_func->list.next);		}		/* add the function to the funcs list */		func->list.next = cont->funcs.next;		func->list.prev = &cont->funcs;		if (cont->funcs.next != NULL) {			cont->funcs.next->prev = &func->list;		}		cont->funcs.next = &func->list;	} else {		/* this is a anonymous function */		/* add the function to the anonym list */		func->list.next = cont->anonym.next;		func->list.prev = &cont->anonym;		if (cont->anonym.next != NULL) {			cont->anonym.next->prev = &func->list;		}		cont->anonym.next = &func->list;	}	func->cont = cont;	context_unlock(cont);	return 0;}
开发者ID:prodigeni,项目名称:kplugs,代码行数:47,


示例17: graph_tree_model_compare_name

gint graph_tree_model_compare_name(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data){  scene::Node* first;  gtk_tree_model_get(model, a, 0, (gpointer*)&first, -1);  scene::Node* second;  gtk_tree_model_get(model, b, 0, (gpointer*)&second, -1);  int result = 0;  if(first != 0 && second != 0)  {    result = string_compare(node_get_name(*first), node_get_name(*second));  }  if(result == 0)  {    return (first < second) ? -1 : (second < first) ? 1 : 0;  }  return result;}
开发者ID:clbr,项目名称:netradiant,代码行数:17,


示例18: match_me

void match_me(void){    if (md.confidence >= CON_DBREF) {	return;    }    if (Good_obj(md.absolute_form) && (md.absolute_form == md.player)) {	promote_match(md.player, CON_DBREF | CON_LOCAL);	return;    }    if (!string_compare(md.string, "me")) {	promote_match(md.player, CON_TOKEN | CON_LOCAL);    }    return;}
开发者ID:TinyMUSH,项目名称:TinyMUSH,代码行数:17,


示例19: server_get_rack

struct rack *server_get_rack(struct datacenter *dc, struct string *rackname){	ASSERT(dc != NULL);	ASSERT(dc->dict_rack != NULL);	ASSERT(dc->name != NULL);	if (log_loggable(LOG_DEBUG)) {		log_debug(LOG_DEBUG, "server_get_rack   '%.*s'", rackname->len, rackname->data);	}	/*   struct rack *rack = dictFetchValue(dc->dict_rack, rackname);   if (rack == NULL) {      rack = array_push(&dc->racks);      rack_init(rack);      string_copy(rack->name, rackname->data, rackname->len);      string_copy(rack->dc, dc->name->data, dc->name->len);      rack->continuum = dn_alloc(sizeof(struct continuum));   	dictAdd(dc->dict_rack, rackname, rack);   }	 */	struct rack *rack;	uint32_t i, len;	for (i = 0, len = array_n(&dc->racks); i < len; i++) {		rack = (struct rack *) array_get(&dc->racks, i);		if (string_compare(rack->name, rackname) == 0) {			return rack;		}	}	rack = array_push(&dc->racks);	rack_init(rack);	string_copy(rack->name, rackname->data, rackname->len);	string_copy(rack->dc, dc->name->data, dc->name->len);	if (log_loggable(LOG_DEBUG)) {		log_debug(LOG_DEBUG, "server_get_rack exiting  '%.*s'",				rack->name->len, rack->name->data);	}	return rack;}
开发者ID:kangkot,项目名称:dynomite,代码行数:45,


示例20: _nsdbtput

void_nsdbtput(const ns_dbt *dbt){	unsigned int	 i;	ns_dbt		*p;	for (i = 0; i < _nsmapsize; i++) {		p = vector_ref(i, _nsmap, _nsmapsize, sizeof(*_nsmap));		if (string_compare(&dbt->name, &p->name) == 0) {			/* overwrite existing entry */			if (p->srclist != NULL)				ns_src_free(&p->srclist, p->srclistsize);			memmove(p, dbt, sizeof(*dbt));			return;		}	}	_nsmap = vector_append(dbt, _nsmap, &_nsmapsize, sizeof(*_nsmap));}
开发者ID:2asoft,项目名称:freebsd,代码行数:18,


示例21: _channels_get

static int _channels_get(MixerControlPlugin * channels, va_list properties){	String const * p;	gboolean * b;	double * value;	size_t i;	unsigned int * u;#ifdef DEBUG	fprintf(stderr, "DEBUG: %s()/n", __func__);#endif	while((p = va_arg(properties, String const *)) != NULL)		if(string_compare(p, "bind") == 0)		{			b = va_arg(properties, gboolean *);			*b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(						channels->bind));		}
开发者ID:DeforaOS,项目名称:Mixer,代码行数:18,


示例22: find_empty_place

voidfind_empty_place(void){  /* @@@ while (z3 == 0) this is a nasty one.*/  do    {      r1 = function_r();      r2 = function_r();      strcpy(sA, "   ");      z1 = r1;      z2 = r2;      string_compare();    } while (z3 == 0);  z3 = 0;}
开发者ID:z88dk,项目名称:z88dk,代码行数:19,


示例23: mod_import

PmReturn_tmod_import(pPmObj_t pstr, pPmObj_t *pmod){    pPmImgInfo_t pii = C_NULL;    uint8_t const *imgaddr = C_NULL;    pPmCo_t pco = C_NULL;    PmReturn_t retval = PM_RET_OK;    pPmObj_t pobj;    /* If it's not a string obj, raise SyntaxError */    if (OBJ_GET_TYPE(pstr) != OBJ_TYPE_STR)    {        PM_RAISE(retval, PM_RET_EX_SYNTAX);        return retval;    }    /* Iterate through the global img list */    pii = gVmGlobal.pimglist;    /* Scan until end of list or string matches */    while ((pii != C_NULL)           && (string_compare((pPmString_t)pstr, pii->ii_name) == C_DIFFER))    {        pii = pii->next;    }    /* If img was not found, raise ImportError */    if (pii == C_NULL)    {        PM_RAISE(retval, PM_RET_EX_IMPRT);        return retval;    }    /* Make copy of addr so image list pointer isn't modified */    imgaddr = pii->ii_addr;    /* Load img into code obj */    retval = obj_loadFromImg(pii->ii_memspace, &imgaddr, &pobj);    PM_RETURN_IF_ERROR(retval);    pco = (pPmCo_t)pobj;    return mod_new((pPmObj_t)pco, pmod);}
开发者ID:BackupGGCode,项目名称:megapython,代码行数:43,


示例24: gserverplatform_get_driver

/* gserverplatform_get_driver */String const * gserverplatform_get_driver(GServerPlatform * platform,		String const * subsystem){	struct	{		String const * subsystem;		String const * fallback;	} fallback[] =	{		{ "video",	"glx"	}	};	size_t i;	for(i = 0; i < sizeof(fallback) / sizeof(*fallback); i++)		if(string_compare(fallback[i].subsystem, subsystem) == 0)			return _gserverplatform_get_string(platform, "drivers",					subsystem, fallback[i].fallback);	return _gserverplatform_get_string(platform, "drivers", subsystem,			NULL);}
开发者ID:DeforaOS,项目名称:GServer,代码行数:21,


示例25: context_lock

/* find a function by name */void *context_find_function(context_t *cont, byte *name){	function_t *func;	context_lock(cont);	func = LIST_TO_STRUCT(function_t, list, cont->funcs.next);	while (func != NULL) {		if (!string_compare(func->name, (char *)name)) {			function_get(func);			context_unlock(cont);			return func;		}		func = LIST_TO_STRUCT(function_t, list, func->list.next);	}	context_unlock(cont);	return NULL;}
开发者ID:prodigeni,项目名称:kplugs,代码行数:22,


示例26: object_remove_symbol

bool object_remove_symbol(memptr object, memptr symbol) {	memptr previous_node = object, current_node, next_node =			cons_pool[object].cdr, current_data;	if (next_node != nil) {		do {			current_node = next_node;			current_data = cons_pool[current_node].car;			if (string_compare(get_string(cons_pool[current_data].car, 0),					get_string(cons_pool[symbol].car, 0))) {				cons_pool[previous_node].cdr = cons_pool[current_node].cdr;				cons_pool[previous_node].cdrKind =						cons_pool[current_node].cdrKind;				return true;			}			previous_node = current_node;			next_node = cons_pool[current_node].cdr;		} while (cons_pool[current_node].cdrKind != NIL);	}	return false;}
开发者ID:OriRoth,项目名称:Keti-Programming-Language-v2-OOP,代码行数:21,


示例27: string_sort

int string_sort(void){   int i, j, k, arraySize;   char temp[20];   arraySize = sizeof(names)/sizeof(names[0]);   for(k=0; k < (arraySize - 1); k++){         //bubble sort      for(i=0; i < (arraySize - k - 1); i++){          if(string_compare(i,i+1) == 1){      //if string[i] > string[i+1], swap              for(j=0; names[i][j]!='/0'; j++)                  temp[j] = names[i][j];      //copy to temp              temp[j] = '/0';              for(j=0; names[i+1][j] != '/0'; j++)                   names[i][j] = names[i+1][j];              names[i][j] = '/0';              for(j=0; temp[j] != '/0'; j++)                  names[i+1][j] = temp[j];              names[i+1][j] = '/0';            }      }   }   return arraySize;}
开发者ID:Nishad94,项目名称:Project-Euler,代码行数:21,


示例28: conf_handler

static rstatus_tconf_handler(struct conf *cf, void *data){    struct command *cmd;    struct string *key, *value;    uint32_t narg;    if (array_n(&cf->arg) == 1) {        value = array_top(&cf->arg);        log_debug(LOG_VVERB, "conf handler on '%.*s'", value->len, value->data);        return conf_pool_init(data, value);    }    narg = array_n(&cf->arg);    value = array_get(&cf->arg, narg - 1);    key = array_get(&cf->arg, narg - 2);    log_debug(LOG_VVERB, "conf handler on %.*s: %.*s", key->len, key->data,              value->len, value->data);    for (cmd = conf_commands; cmd->name.len != 0; cmd++) {        char *rv;        if (string_compare(key, &cmd->name) != 0) {            continue;        }        rv = cmd->set(cf, cmd, data);        if (rv != CONF_OK) {            log_error("conf: directive /"%.*s/" %s", key->len, key->data, rv);            return NC_ERROR;        }        return NC_OK;    }    log_error("conf: directive /"%.*s/" is unknown", key->len, key->data);    return NC_ERROR;}
开发者ID:adityashanbhag,项目名称:twemproxy,代码行数:40,


示例29: check_create_process

/* * This function is used to check if a process is created correctly. * It checks for the PCB entry and process stack */void check_create_process(char* name,			  int priority,			  void (*entry_point) (PROCESS, PARAM),			  PARAM param) {   //find the PCB entry for the process   PROCESS this_process = find_process_by_name(name);     //if the process is not in the pcb array, it is incorrect.   if (this_process == NULL)   {      test_result = 10;      return;   }   //check if the PCB entry is initialized correctly     if (this_process-> magic != MAGIC_PCB ||       this_process -> used != TRUE ||       this_process -> state != STATE_READY ||       this_process-> priority != priority )    {      test_result = 11;      return;   }    //check new process's stack   if(string_compare(name, boot_name))   {      //no need to check boot process's stack      return;   }   unsigned stack_pointer = this_process->esp;   if (peek_l(stack_pointer + 28 ) != (LONG) entry_point )    {      test_result = 12;      return;   }}
开发者ID:AbhijitParate,项目名称:TOS,代码行数:44,


示例30: connect_player

dbrefconnect_player(const char *name, const char *password){    dbref   player, i;    if (*name == '#' && number(name+1) && atoi(name+1)) {        player = (dbref) atoi(name + 1);        if ((!OkObj(player)) || (Typeof(player) != TYPE_PLAYER))            player = NOTHING;    } else {        player = lookup_player(name);    }    if (player == NOTHING) {        /* Check for a player not in the hashtable */        for(i = (db_top - 1); i > NOTHING; i--) {            if(Typeof(i) == TYPE_PLAYER) {                if(!string_compare(name, NAME(i))) {                    /* Oooga, found a player that lookup didn't! */                    log_status(HASH1_MSG);                    wall_wizards(MARK HASH1_MSG);                    refresh_players();                    player = lookup_player(name);                    if(player == NOTHING) {                        log_status(HASH2_MSG);                        wall_wizards(MARK HASH2_MSG);                    }                    break;                }            }        }        if(player == NOTHING)            return NOTHING;    }    if (DBFETCH(player)->sp.player.password            && *DBFETCH(player)->sp.player.password            && strcmp(DBFETCH(player)->sp.player.password, password))        return NOTHING;    return player;}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:40,



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


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