예제 #1
0
int main()
{
    char *s;

    s = "1234567";
    printf("strlen of %s is %d \n", s, strlen2(s));
    s = "abcd";
    printf("strlen of %s is %d \n", s, strlen2(s));
    return 0;
}
예제 #2
0
파일: strlen.c 프로젝트: sangeeths/strings
int main()
{
	char s[] = "test string";
	char *p = "another string";

	printf("strlen1(%s) = %d \n", s, strlen1(s));
	printf("strlen1(%s) = %d \n", p, strlen1(p));

	printf("strlen2(%s) = %d \n", s, strlen2(s));
	printf("strlen2(%s) = %d \n", p, strlen2(p));

	return 0;
}
예제 #3
0
__attribute__((always_inline)) size_t strcspn2(const char* cs, const char* ct) {
  size_t n;
  const char* p;
  int ctSize = strlen2(ct);
  int count = 50;

  for(n = 0; n < count; n++) {
    p = ct;
    if(!*cs)  // if reached end of string
      break;

    for(int j = 0; j < ctSize; j++){
      if(*p == *cs)
        break;
      p++;  
    }

    // if any one character in the string was matched break
    if(*p)
      break;
    cs++;
  }

  if(!*cs)
    return n;

  // nothing from the reject set matched any character in the source string 
  if(!*p){
    return n + strcspn(cs, ct);
  }
  else{
    return n;
  }
}
예제 #4
0
파일: 37_strlen.c 프로젝트: bodii/test-code
int main(void)
{
	char str[] = "abcdf dfds w2r !flfd j dfsf";

	printf("\"%s\"  length is: %d\n", str, strlen2(str)); 
	return 0;
}
예제 #5
0
__attribute__((always_inline)) size_t strspn2(const char* cs, const char* ct) {
  size_t n;
  const char* p;
  int ctSize = strlen2(ct);
  int count = 50;
  for(n = 0; n < count; n++) {
    p = ct;
    for(int j = 0; j < ctSize; j++){
      if(*p == *cs)
        break;
      p++;  
    }

    if (!*p)
      break;
    cs++;
  }

  if(*p){
    return n + strspn(cs, ct);
  }
  else{
    return n;
  }
}
예제 #6
0
 void sendATCommand( char * command, int waitTime, char CRout){
	 char frame2[50];
	 char done = 0;
	 char count = 0;
	 int j = 0;
	 int size;
	 int commandLen = strlen2(command);
	 for (j = 0; j < 50; j++)
		frame2[j] = 0;
	 
	 frame2[0] = 0;
	 frame2[1]  = 0;

	 do{
		 UART_OutString(command);
		 if (CRout)
			UART_OutChar(CR);
	Delay(500000*waitTime);
	j = 0;
  size = RxFifo_Size();
	while (size>0){
		frame2[j++] = UART_InChar();
		size = RxFifo_Size();
//		Delay(500000);
	}
	j = 0;
	while (frame2[j] != 'O') j++;
	if (frame2[j] == 'O' && frame2[j+1] == 'K' && frame2[j+2] == CR)
		done = 1;
	count++;
	} while (!done && count < 10);
 }
예제 #7
0
파일: Questoes1.c 프로젝트: Qu4tro/PI
char* strcat(char s1[], char s2[]){
  int i;
  int len_s1 = strlen2(s1);

  for(i = 0; s2[i] != '\0'; i++){
    s1[i + len_s1] = s2[i];
  }

  return s1;
}
예제 #8
0
__attribute__((always_inline)) int strcmp2(const char* s1, const char* s2){  
  int length2 = strlen2(s2);
  for(int i = 0; i < length2; i++){
    if(*s1 && (*s1==*s2)){
      s1++,s2++;
    }
    else
      break;
  }
  return *(const unsigned char*)s1-*(const unsigned char*)s2;
}
예제 #9
0
//Imprime un mensaje en una zona de la pantalla
void message(char * mensaje, int offset, int minioffset)
{
	int longitud;
	int mitty;
	char* pantalla=(char*)0xb8000;
	char *video ;
	mitty=GetTTY();
	video=(char*)tty[mitty].terminal;
	longitud = strlen2(mensaje);
	memcpy3(video + 160*offset+minioffset, mensaje, longitud);
}
예제 #10
0
//Imprime un mensaje en la consola de errores
void puterr(char* s)
{
	int mitty;	
	int len;
	char *video ;
	mitty=GetTTY();
	len=strlen2(s);
	video=(char*)tty[mitty].terminal;
	blank(70,24,0);
	message(s,24,0);
}
예제 #11
0
//Imprime un mensaje donde esta el cursor
void mess(char* s)
{
	int mitty;	
	int len;
	char *video ;
	mitty=GetTTY();
	len=strlen2(s);
	video=(char*)tty[mitty].terminal;
	memcpy3(&video [tty[mitty].movimiento], s,len);
	tty[mitty].movimiento+=len*2;
}
예제 #12
0
파일: 6strlen.c 프로젝트: f2008700/BITS
int main()
{

	char str1[]="program";
	printf("strlen1 output = %d\n",strlen1(str1));
	printf("strlen2 output = %d\n",strlen2(str1));
	printf("strlen3 output = %d\n",strlen3(str1));
	printf("strlen4 output = %d\n",strlen4(str1));
	
	return 0;
}
예제 #13
0
int main(int argc, char const *argv[])
{
    char strArr[] = "char array";
    const char* str = "char pointer";
    int len = strlen(str);
    int len1 = strlen1(str);
    int len2 = strlen2(str);
    int len3 = strlen3(str);
    int len4 = strlen4(str);
    int len5 = strlen5(str);
    printf("%d, %d, %d, %d, %d, %d\n", len, len1, len2, len3, len4, len5);
    return 0;
}
main()
{
	int n1, n2;
	int strlen(char *), strlen2(char *);
	char buf[1000];

	while (fgets(buf, sizeof buf, stdin) != NULL) {
		n1 = strlen(buf);
		n2 = strlen2(buf);
		printf("%d %d\n", n1, n2);
	}
	return 0;
}
예제 #15
0
void make_note (const char* board_name, const char *sender, const char *to, const char *subject, const int expire_days, const char *text)
{
	int board_index = board_lookup (board_name);
	BOARD_DATA *board;
	NOTE_DATA *note;
	char *strtime;
	
	if (board_index == BOARD_NOTFOUND)
	{
		bug ("make_note: board not found",0);
		return;
	}
	
	if (strlen2(text) > MAX_NOTE_TEXT)
	{
		bug ("make_note: text too long (%d bytes)", strlen2(text));
		return;
	}
	
	
	board = &boards [board_index];
	
	note = new_note(); /* allocate new note */
	
	note->sender = str_dup (sender);
	note->to_list = str_dup(to);
	note->subject = str_dup (subject);
	note->expire = current_time + expire_days * 60 * 60 * 24;
	note->text = str_dup (text);

	/* convert to ascii. ctime returns a string which last character is \n, so remove that */	
	strtime = ctime (&current_time);
	strtime[strlen(strtime)-1] = '\0';
	
	note->date = str_dup (strtime);
	
	finish_note (board, note);
	
}
예제 #16
0
void DoMasterAMR(char *buf, int size, int who, int tag, thread_arg_t *targ)	{
	MasterGamlConfig *conf = targ->conf;
	Population *pop = targ->pop;
	int count, start_shield, which;
	char *tree_strings, *model_buf;
	double *models, score;

	assert(tag == TAG_SCORE);
	memcpy(&score, buf, sizeof(double));
	//delete [] buf;

	// print some messages
	debug_mpi("SYNCHRONOUS COMM (%d, AMR, %f)", who, pop->bestFitness);
	debug_mpi("\trecv: score %f", score);

	if (score > pop->bestFitness)	{
		SendMPIMessage(NULL, 0, who, TAG_TREE_STRINGS_REQUEST);
		debug_mpi("\tsent: TAG_TREE_STRINGS_REQUEST");
		RecvMPIMessage(&buf, &size, who, &tag, true);
		assert(tag == TAG_TREE_STRINGS);
		tree_strings = buf;
		debug_mpi("\trecv: %d tree strings", CountTreeStrings(tree_strings));

		RecvMPIMessage(&buf, &size, who, &tag, true);
		assert(tag == TAG_MODEL);
		models=(double*)buf;
		
		which = pop->total_size-1;
		pop->ReplaceSpecifiedIndividuals(1, &which, tree_strings, models);
		pop->CalcAverageFitness();
		debug_mpi("score sent: %f, score calced: %f", score, pop->IndivFitness(which));
		//assert(abs(score -  pop->IndivFitness(which))<.00001);
		}
	else	{
		which = (int)pop->cumfit[pop->total_size-1][0];
		pop->GetSpecifiedTreeStrings(&tree_strings, 1, &which);
		int model_size=pop->GetSpecifiedModels(&models, 1, &which);

		SendMPIMessage(tree_strings, strlen2(tree_strings)+2, who, TAG_TREE_STRINGS);
		debug_mpi("\tsent: %d tree strings", CountTreeStrings(tree_strings));

		model_buf = (char*)models;
		SendMPIMessage(model_buf, sizeof(double)*model_size, who, TAG_MODEL);
		debug_mpi("\tsent: %d models", 1);
		}
	delete [] tree_strings;
	delete [] models;
	}
예제 #17
0
//Imprime un mensaje y un enter en donde esta el cursor
void messl(char* s)
{
	int mitty;	
	int len;
	char *video ;
	mitty=GetTTY();
	len=strlen2(s);
	video=(char*)tty[mitty].terminal;
	memcpy3(&video [tty[mitty].movimiento], s,len);
	tty[mitty].movimiento+=len*2;
	tty[mitty].movimiento=tty[mitty].movimiento-tty[mitty].movimiento%160+160;
	if (tty[mitty].movimiento / 160 >= 24)
	{
		Scroll();
	}
}
예제 #18
0
static int decompile_single_mode(const char *name)
{
	static const char *hexa_entries[] = {
		"dram_baseaddr", "dram_zq", "dram_tpr", "dram_emr",
		"g2d_size",
		"rtp_press_threshold", "rtp_sensitive_level",
		"ctp_twi_addr", "csi_twi_addr", "csi_twi_addr_b", "tkey_twi_addr",
		"lcd_gamma_tbl_",
		"gsensor_twi_addr",
		NULL };
	size_t l = strlen2(name);

	if (find_full_match(name, l, hexa_entries))
		return 0;
	else
		return -1;
}
예제 #19
0
void RemoteSendBestTree(Population& pop){
	int *which=new int;
	char *tree_strings;
	double *models;
	
	pop.GetNBestIndivIndices(&which, 1);
	pop.GetSpecifiedTreeStrings(&tree_strings, 1, which);
	int size=strlen2(tree_strings)+2;
//	debug_mpi("about to send treestrings...");
	SendMPIMessage(tree_strings, size, 0, TAG_TREE_STRINGS);
	debug_mpi("\tsent ind %d, lnL %f", *which, pop.indiv[*which].Fitness());
//	debug_mpi("about to send modelstrings...");
	int model_size=pop.GetSpecifiedModels(&models, 1, which);
	SendMPIMessage((char*) models, sizeof(double)*model_size, 0, TAG_MODEL);
//	debug_mpi("about to send subdef...");
	char std[5];
	sprintf(std, "%d", pop.subtreeDefNumber);
	SendMPIMessage(std, strlen(std)+2, 0, TAG_SUBTREE_ITERATION);
	
	if(pop.subtreeDefNumber!=0){
		char stn[10];
		sprintf(stn, "%d", pop.subtreeNode);
		SendMPIMessage(stn, strlen(stn)+2, 0, TAG_SUBTREE_DEFINE);
		debug_mpi("\tvalid for subtree def %d, node %d", pop.subtreeDefNumber, pop.subtreeNode);
		}
	else
		debug_mpi("\tno defined subtree");
		
	//finally, send the score
	double score = pop.indiv[*which].Fitness();
	SendMPIMessage((char*)&score, sizeof(double), 0, TAG_SCORE);	
	
	delete which;
	delete [] tree_strings;
	delete [] models;
	}
예제 #20
0
void	test_strlen()
{
	strlen1();
	strlen2();
	strlen3();
}
예제 #21
0
파일: strlen.c 프로젝트: jamesmartinez/DSA
int main(void)
{
  char x[10] = "abcdefgh";
  printf("%d\n", strlen2(x));
  return 0;
}
예제 #22
0
int DoMasterSW(char *buf, int size, int who, int tag, thread_arg_t *targ)	{
	MasterGamlConfig *conf = targ->conf;
	Population *pop = targ->pop;
	int count, start_shield, *which = new int;//[conf->gc.numshields];
	char *tree_strings, *model_buf;
	char *out_tree_strings;
	char *defbuf, *subbuf;
	double *out_models;
	double *models;
	int remoteSubtreeDef, remoteSubtreeNode;
	ParallelManager *paraMan=(pop->paraMan);

//first get the tree and model from the remote and include it in
//the master population.  If there are multiple messages, chuck 
//earlier ones and just get the most recent
	bool firstmessage=true;
	do{
		debug_mpi("Remote %d", who);
		assert(tag == TAG_TREE_STRINGS || tag == TAG_QUIT);
		if(tag==TAG_QUIT) return 1;
		tree_strings = buf;
		count = CountTreeStrings(tree_strings);
		
//		debug_mpi("about to get model strings...");

		RecvMPIMessage(&buf, &size, who, &tag, true);
		assert(tag == TAG_MODEL);
		models=(double*)buf;
		
//		debug_mpi("about to get subdef strings...");

		//determine what the remote was doing when it sent this tree
		RecvMPIMessage(&defbuf, &size, who, &tag, true);
		assert(tag==TAG_SUBTREE_ITERATION);
		remoteSubtreeDef=atoi(defbuf);
		
		if(remoteSubtreeDef>0){
			RecvMPIMessage(&subbuf, &size, who, &tag, true);
			assert(tag==TAG_SUBTREE_DEFINE);
			remoteSubtreeNode=atoi(subbuf);
			if(remoteSubtreeDef==paraMan->subtreeDefNumber)
				paraMan->localSubtreeAssign[who]=remoteSubtreeNode;
			else paraMan->localSubtreeAssign[who]=0;
			delete []subbuf;
			}
		//DJZ 5-18-05
		else {
			paraMan->localSubtreeAssign[who]=0;
			remoteSubtreeNode=0;
			}
		
		double score;
		char *scoreBuf;
		RecvMPIMessage(&scoreBuf, &size, who, &tag, true);
		assert(tag==TAG_SCORE);
		memcpy(&score, scoreBuf, sizeof(double));
//		debug_mpi("recieved score of %f", score);
		delete []scoreBuf;
		
		if(firstmessage==false) debug_mpi("\tfound another tree from remote %d", who);

		*which = start_shield = pop->params->nindivs + (who-1);
		pop->ReplaceSpecifiedIndividuals(count, which, tree_strings, models);
	
		pop->indiv[*which].SetFitness(score);
		if(firstmessage==false) delete []tree_strings;
		delete [](char*)models;
		delete []defbuf;

		firstmessage=false;
		}while(RecvMPIMessage(&buf, &size, who, &tag, false)==true);
	
	bool subtreesCurrent = ((remoteSubtreeDef == paraMan->subtreeDefNumber) && remoteSubtreeDef > 0);
	
	if(paraMan->subtreeModeActive==false || subtreesCurrent==false){
		pop->indiv[*which].accurateSubtrees=false;
		pop->newindiv[*which].accurateSubtrees=false;
		}
	else {
		pop->indiv[*which].accurateSubtrees=true;
		pop->newindiv[*which].accurateSubtrees=true;
		}

//	debug_mpi("about to CalcFitness...");
	double prevBestScore=pop->BestFitness();
//	pop->indiv[*which].CalcFitness(0);
	pop->indiv[*which].treeStruct->calcs=calcCount;
	pop->CalcAverageFitness();

	//reclaim clas if the new tree has essentially no chance of reproducing
	if(((pop->indiv[*which].Fitness() - pop->indiv[pop->bestIndiv].Fitness()) < (-11.5/pop->params->selectionIntensity))){
//		debug_mpi("about to reclaim...");
		pop->indiv[*which].treeStruct->ReclaimUniqueClas();
		}
	

	//Now, take a look at what we got from the remote and decide what to do
	double inscore=pop->indiv[*which].Fitness();
	double scorediff=prevBestScore - inscore;
	debug_mpi("\tnew ind - def %d - node %d - lnL: %f", remoteSubtreeDef, remoteSubtreeNode, inscore);
	if(scorediff < 0) debug_mpi("\tPrev Best=%f, diff=%f (new best)", prevBestScore, scorediff);
	else debug_mpi("\tPrev Best=%f, diff=%f", prevBestScore, scorediff);
//	debug_mpi("\tbest=%d, bestAc=%d, bestlnL=%f, bestAcclnL=%f", pop->bestIndiv, pop->bestAccurateIndiv, pop->BestFitness(), pop->indiv[pop->bestAccurateIndiv].Fitness());

	
	bool recalcSubtrees=false;
	if(scorediff < -0.01){
		pop->LogNewBestFromRemote(-scorediff, *which);
		}

	int subtreeNum;
	bool send=false;
	
	//there are really 8 possible cases here
	//1. Subtree mode active, 	got accurate tree,	score good -> do nothing
	//2. 											score bad  -> send best accurate tree
	//3. 						inaccurate tree,	score good -> recalc subtrees, send?
	//4.											score bad  -> send best accurate tree
	//5. Subtree mode inactive, got accurate tree, 	score good -> send best tree
	//6.											score bad  -> send best tree
	//7.						inaccurate tree, 	score good -> do nothing
	//8.											score bad  -> send best tree
	//so, 2 "do nothings" 3 "send best", 2 "send best accurate" and 1 "subtree recalc"
	
//if subtree mode isn't active, send the remote our best tree if the
//tree we got from it is worse by some amount, or if it is still working
//on a subtree
	
	double updateThresh=paraMan->updateThresh;
//DEBUG
//	if(paraMan->subtreeModeActive==false && (paraMan->needToSend[who]==true || ((scorediff > nonSubThresh && paraMan->beforeFirstSubtree==false) || (scorediff > startThresh && paraMan->beforeFirstSubtree==true) || remoteSubtreeDef>0))){
	if(paraMan->subtreeModeActive==false){
		if((paraMan->perturbModeActive==false && (scorediff > updateThresh || remoteSubtreeDef>0))/* || (paraMan->needToSend[who]==true)*/){
			debug_mpi("\tupdate thresh = %f, send indiv", updateThresh);
			//cases 5, 6 and 8
			*which = (int)pop->cumfit[pop->total_size-1][0];
			subtreeNum=0;
			send=true;
			}
		else debug_mpi("\tupdate thresh = %f", updateThresh);
		}
		
	else if(paraMan->subtreeModeActive==true){
		//cases 1-4
		if((scorediff > updateThresh) || (subtreesCurrent==false)/* || paraMan->perturb==true*/){
			//cases 2 and 4.  send the best accurate tree
			*which=pop->bestAccurateIndiv;	
			if(paraMan->remoteSubtreeAssign[who] != 0) subtreeNum=paraMan->remoteSubtreeAssign[who];
			else subtreeNum=paraMan->ChooseSubtree();
			debug_mpi("\tsend best accurate ind, %f (best=%f)", pop->indiv[*which].Fitness(), pop->bestFitness);
//			debug_mpi("\tperturb=%d, bestFit=%f, indFit=%f", paraMan->perturb, pop->bestFitness, pop->indiv[*which].Fitness());
			send=true;
			}
		else if(recalcSubtrees==true && subtreesCurrent==false){
			//case 3
			//if the new inaccurate tree that came in is better than what we have,
			//recalcuate the subtrees, and send the same tree back, but with a 
			//subtree asignment
			pop->StartSubtreeMode();
			debug_mpi("Recalculating subtrees");
			subtreeNum=paraMan->ChooseSubtree();
			send=true;
			}
		}

	if(paraMan->needToSend[who]){
		char pertbuf[5];
		int perttype = (pop->pertMan->pertType > 0 ? pop->pertMan->pertType : (int)(rnd.uniform() * 2 + 1));
		sprintf(pertbuf, "%d", perttype);
		SendMPIMessage(pertbuf, strlen(pertbuf)+2, who, TAG_PERTURB);
		debug_mpi("sending pertub message to %d, type %d", who, perttype);
		paraMan->needToSend[who]=false;
		}


	if(send==true){
		pop->GetSpecifiedTreeStrings(&out_tree_strings, 1, which);
		
		assert(*out_tree_strings == '(');
		int model_size=pop->GetSpecifiedModels(&out_models, 1, which);
		
		SendMPIMessage(out_tree_strings, strlen2(out_tree_strings)+2, who, TAG_TREE_STRINGS);
		SendMPIMessage((char*)out_models, sizeof(double)*model_size, who, TAG_MODEL);

/*		if(paraMan->needToSend[who]){
			char pertbuf[5];
			int perttype = (pop->pertMan->pertType > 0 ? pop->pertMan->pertType : (rnd.uniform() * 2 + 1));
			sprintf(pertbuf, "%d", subtreeNum);
			SendMPIMessage(NULL, 0, who, TAG_PERTURB);
			debug_mpi("sending pertub message to %d, type %d", who, perttype);
			paraMan->needToSend[who]=false;
			}
*/			
//		else{
			char stn[5];
			sprintf(stn, "%d", subtreeNum);
			SendMPIMessage(stn, strlen(stn)+2, who, TAG_SUBTREE_DEFINE);
			debug_mpi("\tsent ind %d, lnL %f", *which, pop->indiv[*which].Fitness());

			if(subtreeNum > 0){
				//if this node was already assigned a subtree, be sure to subtract the old one from the assigned array
				sprintf(stn, "%d", paraMan->subtreeDefNumber);
				debug_mpi("\tsubdef %d, node %d", paraMan->subtreeDefNumber, subtreeNum);
				SendMPIMessage(stn, strlen(stn)+2, who, TAG_SUBTREE_ITERATION);
				}
			
//			}
		paraMan->remoteSubtreeAssign[who]=subtreeNum;
		
		delete []out_models;
		delete []out_tree_strings;		
		}
#ifndef NDEBUG
	if(paraMan->subtreeModeActive && paraMan->subtreeDefNumber==remoteSubtreeDef){
        //DEBUG
        //if we think that this remote gave us a tree with accurate subtrees, check
        paraMan->CheckSubtreeAccuracy(pop->indiv[which[0]].treeStruct);
		}
#endif
	
	//the tree_strings that were passed in will be deleted back
	//where the initial call to RecvMPIMessage was made
	delete [] which;

	pop->CalcAverageFitness();
	return 0;
}
예제 #23
0
fivePointFour() {
	printf("the length of \"jiawei\" is %d\n", strlen2("jiawei"));
}
예제 #24
0
void handle_con_note_text (DESCRIPTOR_DATA *d, char * argument)
{
	CHAR_DATA *ch = d->character;
	char buf[MAX_STRING_LENGTH];
	char letter[4*MAX_STRING_LENGTH];
	
	if (!ch->pcdata->in_progress)
	{
		d->connected = CON_PLAYING;
		bug ("nanny: In CON_NOTE_TEXT, but no note in progress",0);
		return;
	}

	/* First, check for EndOfNote marker */

	strcpy (buf, argument);
	if ((!str_cmp(buf, "~")) || (!str_cmp(buf, "END")))
	{
		write_to_buffer (d, "\n\r\n\r",0);
		write_to_buffer (d, szFinishPrompt, 0);
		write_to_buffer (d, "\n\r", 0);
		d->connected = CON_NOTE_FINISH;
		return;
	}
  else if (!str_cmp(buf, "~delete"))
  {
    delete_last_line_in_note(ch);
    return;
  }
	
	smash_tilde (buf); /* smash it now */

	/* Check for too long lines. Do not allow lines longer than 80 chars */
	
	if (strlen(buf) > MAX_LINE_LENGTH)
	{
		write_to_buffer (d, "Too long line rejected. Do NOT go over 80 characters!\n\r",0);
		return;
	}
	
	/* Not end of note. Copy current text into temp buffer, add new line, and copy back */

	/* How would the system react to strcpy( , NULL) ? */		
	if (ch->pcdata->in_progress->text != NULL)
	{
		strcpy (letter, ch->pcdata->in_progress->text);
		free_string (ch->pcdata->in_progress->text);
		ch->pcdata->in_progress->text = NULL; /* be sure we don't free it twice */
	}
	else
		strcpy (letter, "");
		
	/* Check for overflow */
	
	if ((strlen2(letter) + strlen2(buf)) > MAX_NOTE_TEXT)
	{ /* Note too long, take appropriate steps */
		write_to_buffer (d, "Note too long!\n\r", 0);
		free_note (ch->pcdata->in_progress);
		ch->pcdata->in_progress = NULL;			/* important */
		d->connected = CON_PLAYING;
		return;			
	}
	
	/* Add new line to the buffer */
	
	strcat (letter, buf);
	strcat (letter, "\r\n"); /* new line. \r first to make note files better readable */

	/* allocate dynamically */		
	ch->pcdata->in_progress->text = str_dup (letter);
}
예제 #25
0
파일: XbeeOut.c 프로젝트: glockwork/EE445L
void XBee_sendDataFrame(char * data){
	XBee_CreateTxFrame(strlen2(data), 1, data,frame);
	XBeeSendTxFrame(frame, strlen2(data) + 9);

}
예제 #26
0
void main()
{
    char s[]="asdfasdfasdf";
    printf("lenth:%d\n",strlen(s));
    printf("lenth2:%d\n",strlen2(s));
}