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

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

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

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

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

示例1: while

	int32 Interp::runScript(char* script, uint32 size, void* context)	{		char* buf = script, * line = NULL;		char* token = NULL, * param_string = NULL;		int32 out = 0, current_line = 0, ret = 0, k = 0;		while (1) {			line = Utils::getToken(&buf, CRLF, size, 2);			if (!line)				break;			/* remove '/n' and blanks */			out = (int32) strlen(line);			while (--out && isspace(toascii(line[out])))				line[out] = 0;			/* remove blanks */			k = (int32) strlen(line);			while (k && isspace(toascii(*line))) {				k--; line++;			}			/* remove empty lines and comments */			if (line[0] == '#' || line[0] == '/0') {				current_line++; continue;			}			/* execute instruction */			param_string = line;			token = Utils::getToken(&param_string, " /t");			if (token)				ret = run(token, param_string, context);			else {				current_line++; continue;			}			/* get return value */			switch (ret) {			case Interp::BADCOMMAND:			case Interp::PARAMPARSINGERROR:			case Interp::WRONGPARAMCOUNT:			case Interp::PERMISSIONDENIED:				sysHandler(token, current_line, ret, context);				return FAILURE;			default:				usrHandler(token, current_line, ret, context);			}			current_line++;		}		return SUCCESS;	}
开发者ID:BackupTheBerlios,项目名称:digixound-svn,代码行数:53,


示例2: printfn

/* * Print out a filename (or other ascii string). * Return true if truncated. */intprintfn(u_char *s, u_char *ep){	u_char c;	putchar('"');	while ((c = *s++) != 0) {		if (s > ep) {			putchar('"');			return (1);		}		if (!isascii(c)) {			c = toascii(c);			putchar('M');			putchar('-');		}		if (!isprint(c)) {			c ^= 0x40;			/* DEL to ?, others to alpha */			putchar('^');		}		putchar(c);	}	putchar('"');	return (0);}
开发者ID:ryo,项目名称:netbsd-src,代码行数:29,


示例3: dns_name_element

int dns_name_element(BSB *nbsb, BSB *bsb){    int nlen = 0;    BSB_IMPORT_u08(*bsb, nlen);    if (nlen == 0 || nlen > BSB_REMAINING(*bsb)) {        return 1;    }    int j;    for (j = 0; j < nlen; j++) {        register u_char c = 0;        BSB_IMPORT_u08(*bsb, c);        if (!isascii(c)) {            BSB_EXPORT_u08(*nbsb, 'M');            BSB_EXPORT_u08(*nbsb, '-');            c = toascii(c);        }        if (!isprint(c)) {            BSB_EXPORT_u08(*nbsb, '^');            c ^= 0x40;        }         BSB_EXPORT_u08(*nbsb, c);    }    return 0;}
开发者ID:clementdotck,项目名称:moloch,代码行数:29,


示例4: test_toascii

static voidtest_toascii (void){	int i, j;	for (i = -127; i < 256; )		j = i, printf ("%s: %d -> %d/n", __FUNCTION__, j, toascii (i++));}
开发者ID:ArmstrongJ,项目名称:MiNTLib,代码行数:7,


示例5: main

void main(){	char array[100];	int user_input;	int a;	int point;	while(a<100){array[a]='/0';a++;}		printf("Please enter your numbers here please/r/n");	gets(array);	printf("Please enter the number your looking for /r/n");	scanf("%d",&user_input);	a=0;	int n=0;		while(a<100)	{		if(array[a]=='1'||array[a]=='2'||array[a]=='3'||array[a]=='4'||array[a]=='5'||array[a]=='6'		||array[a]=='7'||array[a]=='8'||array[a]=='9'||array[a]=='0'){n++;}		a++;	}	//printf("There are %d elements in the array/r/n",n);	//printf("A=%d/r/n",a);	point=n-user_input;	//printf("%d is the point /r/n",point);	printf("/n%c is your number/r/n",toascii(digit(array,point)));//as i use a char array 																  //i must convert the integer from the decimal value back to ascii value}
开发者ID:eokeeffe,项目名称:C-code,代码行数:28,


示例6: main

int main(void){  char str[80];  int i;  printf("Enter a string: /r/n");  gets(str);  for( i = 0; str[ i ]; i++)    str[ i ] = toupper( str[ i ] );  printf("%s/n", str); /* uppercase string */  for(i = 0; str[ i ]; i++)    str[i] = tolower(str[ i ]);  printf("%s/n", str); /* lowercase string */    for(i = 0;str[i];i++)	str[i] = toascii(str[i]);/*produces a sum of ascii characters*/  printf("%d/n",str);  return 0;}
开发者ID:eokeeffe,项目名称:C-code,代码行数:26,


示例7: main

int main (void){    char c;    printf ("Enter the character to test: ");    scanf ("%c", &c);    printf ("isalpha ('%c') is %s/n", c, isalpha ((int) c) ? "True" : "False");    printf ("isalnum ('%c') is %s/n", c, isalnum ((int) c) ? "True" : "False");    printf ("isascii ('%c') is %s/n", c, isascii ((int) c) ? "True" : "False");    printf ("iscntrl ('%c') is %s/n", c, iscntrl ((int) c) ? "True" : "False");    printf ("isdigit ('%c') is %s/n", c, isdigit ((int) c) ? "True" : "False");    printf ("isgraph ('%c') is %s/n", c, isgraph ((int) c) ? "True" : "False");    printf ("islower ('%c') is %s/n", c, islower ((int) c) ? "True" : "False");    printf ("isprint ('%c') is %s/n", c, isprint ((int) c) ? "True" : "False");    printf ("ispunct ('%c') is %s/n", c, ispunct ((int) c) ? "True" : "False");    printf ("isspace ('%c') is %s/n", c, isspace ((int) c) ? "True" : "False");    printf ("isupper ('%c') is %s/n", c, isupper ((int) c) ? "True" : "False");    printf ("isxdigit ('%c') is %s/n/n", c,            isxdigit ((int) c) ? "True" : "False");    printf ("tolower ('%c') gives %c/n", c, tolower ((int) c));    printf ("_tolower ('%c') gives %c/n", c, _tolower ((int) c));    printf ("toupper ('%c') gives %c/n", c, toupper ((int) c));    printf ("_toupper ('%c') gives %c/n", c, _toupper ((int) c));    printf ("toascii ('%c') gives %c/n", c, toascii ((int) c));    return (0);}
开发者ID:kavinsivak,项目名称:sandbox,代码行数:29,


示例8: fn_print

/* * Print out a null-terminated filename (or other ascii string). * If ep is NULL, assume no truncation check is needed. * Return true if truncated. */intfn_print(register const u_char *s, register const u_char *ep, char *buf){   register int ret;   register u_char c;   ret = 1;                        /* assume truncated */   while (ep == NULL || s < ep) {      c = *s++;      if (c == '/0') {         ret = 0;         break;      }      if (!isascii(c)) {         c = toascii(c);         sprintf(&buf[strlen(buf)], "%c", 'M');         sprintf(&buf[strlen(buf)], "%c", '-');      }      if (!isprint(c)) {         c ^= 0x40;      /* DEL to ?, others to alpha */         sprintf(&buf[strlen(buf)], "%c", '^');      }      sprintf(&buf[strlen(buf)], "%c", c);   }   return(ret);}
开发者ID:hbock,项目名称:argus-clients,代码行数:31,


示例9: sfn_print

int sfn_print(char* buffer,u_char *s, u_char *ep){	register int ret;	u_char c;	ret = 1;			/* assume truncated */	while (ep == NULL || s < ep) {		c = *s++;		if (c == '/0') {			ret = 0;			break;		}		if (!isascii(c)) {			c = toascii(c);			sprintf(buffer,"%sM",buffer);			sprintf(buffer,"%s-",buffer);		}		if (!isprint(c)) {			c ^= 0x40;	/* DEL to ?, others to alpha */			sprintf(buffer,"%s^",buffer);		}		sprintf(buffer,"%s%s",buffer,&c);	}	return(ret);}
开发者ID:Ancient,项目名称:NetGuard,代码行数:25,


示例10: fn_print

/* * Print out a null-terminated filename (or other ascii string). * If ep is NULL, assume no truncation check is needed. * Return true if truncated. */intfn_print(register const u_char *s, register const u_char *ep){	register int ret;	register u_char c;	ret = 1;			/* assume truncated */	while (ep == NULL || s < ep) {		c = *s++;		if (c == '/0') {			ret = 0;			break;		}		if (!isascii(c)) {			c = toascii(c);			putchar('M');			putchar('-');		}		if (!isprint(c)) {			c ^= 0x40;	/* DEL to ?, others to alpha */			putchar('^');		}		putchar(c);	}	return(ret);}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:31,


示例11: cook_cat

static voidcook_cat(FILE *fp){	int ch, gobble, line, prev;	/* Reset EOF condition on stdin. */	if (fp == stdin && feof(stdin))		clearerr(stdin);	line = gobble = 0;	for (prev = '/n'; (ch = getc(fp)) != EOF; prev = ch) {		if (prev == '/n') {			if (sflag) {				if (ch == '/n') {					if (gobble)						continue;					gobble = 1;				} else					gobble = 0;			}			if (nflag && (!bflag || ch != '/n')) {				(void)fprintf(stdout, "%6d/t", ++line);				if (ferror(stdout))					break;			}		}		if (ch == '/n') {			if (eflag && putchar('$') == EOF)				break;		} else if (ch == '/t') {			if (tflag) {				if (putchar('^') == EOF || putchar('I') == EOF)					break;				continue;			}		} else if (vflag) {			if (!isascii(ch) && !isprint(ch)) {				if (putchar('M') == EOF || putchar('-') == EOF)					break;				ch = toascii(ch);			}			if (iscntrl(ch)) {				if (putchar('^') == EOF ||				    putchar(ch == '/177' ? '?' :				    ch | 0100) == EOF)					break;				continue;			}		}		if (putchar(ch) == EOF)			break;	}	if (ferror(fp)) {		warn("%s", filename);		rval = 1;		clearerr(fp);	}	if (ferror(stdout))		err(1, "stdout");}
开发者ID:camilitodebepensar,项目名称:freebsd-pi,代码行数:60,


示例12: strcpy

void mno_alph::encrypt(){   strcpy(strtext,"   ");  strcpy(strcode,"    ");  len=0;  cout<<"enter key "<<endl;  for(i=0;i<=25;++i)  {   lettertext[i]=toascii(i+97);   cout<<"enter key for "<<lettertext[i];   cin>>key[i];  } cout<<"Enter text   "<<endl; cin>>strtext; len=strlen(strtext); for(i=0;i<=len-1;++i) {    for(j=0;j<=25;++j)    {     if(strtext[i]==lettertext[j])     {       strcode[i]=key[j];     }    } } cout<<"code=   "<<strcode<<endl; }
开发者ID:vbv15,项目名称:helloworld,代码行数:30,


示例13: c_print

const u_char *c_print(register const u_char *s, register const u_char *ep){	register u_char c;	register int flag;	flag = 1;	while (ep == NULL || s < ep) {		c = *s++;		if (c == '/0') {			flag = 0;			break;		}		if (!isascii(c)) {			c = toascii(c);			putchar('M');			putchar('-');		}		if (!isprint(c)) {			c ^= 0x40;	/* DEL to ?, others to alpha */			putchar('^');		}		putchar(c);	}	if (flag)		return NULL;	return (s);}
开发者ID:SylvestreG,项目名称:bitrig,代码行数:28,


示例14: main

int main(int argc, const char * argv[]) {    FILE *file = fopen(argv[1], "r");    char line[1024];    while (fgets(line, 1024, file)) {                int i = 0;    	bool empty = true;        	while (line[i])    	{		    		if (line[i] >= 'a' && line[i] <= 'j')     		{    			printf("%d", toascii(line[i]) - 97);    			empty = false;    		}    		if (line[i] >= '0' && line[i] <= '9')    		{    			empty = false;    			printf("%c", line[i]);    		}    		i++;    	}    	if (empty) printf("NONE");    	printf("/n");    }    return 0;} 
开发者ID:miguelmadera50,项目名称:CodeEval,代码行数:27,


示例15: makeColor

Pixel Orc::render(float luma)  {    Pixel p;    p.fg = makeColor(2,2,2);    p.bg = 0;    p.a = 0;    p.c = toascii('O');    return p;}
开发者ID:vesabios,项目名称:matador,代码行数:8,


示例16: get_random

void get_random(char outstring[],int count){    int i=0,base=126-32;    //get printable ascii character between 32-126    for(i=0;i<count-1;i++)      outstring[i]=toascii((rand()%base)+32);    outstring[i]='/0';}
开发者ID:rupeshthakkar,项目名称:codingground,代码行数:9,


示例17: while

void ServerItem::convert(char *l){	if (strcmp(mode, "netascii") != 0)		return;	while (*l != 0) {		*l = toascii(*l);		l++;	}}
开发者ID:dongxinb,项目名称:MyTFTP,代码行数:9,


示例18: main

int main(){ 	//将整形数转换成合法的ASCII码字符	int a = 217;	char b;	printf("before toascii() : a value =%d(%c)/n",a,a);	b=toascii(a);	printf("after  toascii() : a value =%d(%c)/n",b,b);}
开发者ID:EchoyandSilver,项目名称:linux-c,代码行数:10,


示例19: jkfprintf

voidjkfprintf(FILE *tp, char name[], off_t offset){	char *cp, ch;	char visout[5], *s2;	FILE *fi;	int linecnt, charcnt, inheader;	char line[BUFSIZ];	if ((fi = fopen(name, "r")) == NULL)		return;	(void)fseeko(fi, offset, SEEK_SET);	/*	 * Print the first 7 lines or 560 characters of the new mail	 * (whichever comes first).  Skip header crap other than	 * From, Subject, To, and Date.	 */	linecnt = 7;	charcnt = 560;	inheader = 1;	while (fgets(line, sizeof(line), fi) != NULL) {		if (inheader) {			if (line[0] == '/n') {				inheader = 0;				continue;			}			if (line[0] == ' ' || line[0] == '/t' ||			    (strncmp(line, "From:", 5) &&			    strncmp(line, "Subject:", 8)))				continue;		}		if (linecnt <= 0 || charcnt <= 0) {			(void)fprintf(tp, "...more...%s", cr);			(void)fclose(fi);			return;		}		/* strip weird stuff so can't trojan horse stupid terminals */		for (cp = line; (ch = *cp) && ch != '/n'; ++cp, --charcnt) {			ch = toascii(ch);			vis(visout, ch, VIS_SAFE|VIS_NOSLASH, cp[1]);			for (s2 = visout; *s2; s2++)				(void)fputc(*s2, tp);		}		(void)fputs(cr, tp);		--linecnt;	}	(void)fprintf(tp, "----%s/n", cr);	(void)fclose(fi);}
开发者ID:darksoul42,项目名称:bitrig,代码行数:50,


示例20: main

int main(void) {  int i = 8;  int j = 5;  double x = 0.005, y = -0.01;  char c = 'c', d = 'd';  // Absolute value of integer  printf("a) %d /n", abs(i - 2 * j));  // Absolute value of floating point number  printf("b) %f /n", fabs(x+y));  // 1-0, printable or not  printf("c) %d /n", isprint(c));  // 1-0, parameter is decimal digit or not  printf("d) %d /n", isdigit(c));  // Convert form lowercase to uppercase  printf("e) %d /n", toupper(d));  // Round upwards  printf("f) %f /n", ceil(x));  // Round updwards  printf("g) %f /n", ceil(x+y));  // Round downwards  printf("h) %f /n", floor(x));  // Round downwards  printf("i) %f /n", floor(x+y));  // 1-0, lowercase letter or not  printf("j) %d /n", islower(c));  // 1-0 is uppercase letter or not  printf("k) %d /n", isupper(j));  // Base e exponential function, e^x  printf("l) %f /n", exp(x));  // Natural logarithm  printf("m) %f /n", log(exp(x)));  // Square root  printf("o) %f /n", sqrt(x*x+y*y));  // 1-0, is dedimal digit or letter  printf("p) %d /n", isalnum(10*j));  //1-0, is alphabetic letter or not  printf("q) %d /n", isalpha(10*j));  // 1-0, ascii or not  printf("r) %d /n", isascii(10*j));  // Converts to ascii  printf("s) %d /n", toascii(10*j));  // Floating point remainder of x/y  printf("t) %f /n", fmod(x,y));  // Converts to lowercase if a letter  printf("u) %d /n", tolower(65));  // Length of string before termination  printf("v) %zu /n", strlen("hello/0"));  // WTF  //printf("w) %d /n", strpos("hello/0", 'e'));}
开发者ID:rase-,项目名称:syksy2012,代码行数:50,


示例21: length

/**********************СОРТИРОВКА ПО ДЛИНЕ***************************/void length(void){ FILE *f,*f1; char filename[14],nameoffile[14]; char c; int i,n=0,k; instr com; window(1,1,80,25); textbackground(0); textcolor(2); clrscr(); cputs("Введите имя файла-источника данных..."); scanf("%s",filename); cputs("Введите имя файла,в который будут записаны данные..."); scanf("%s",nameoffile); f=fopen(filename,"r"); f1=fopen(nameoffile,"aw"); fseek(f,0,SEEK_SET); while(!feof(f))  {   fread(&com,sizeof(com),1,f);   n++;  } printf("Мнемокод    Длина  Машинный код/n"); n--; for(k=49;k<=57;k++)  {   fseek(f,0,SEEK_SET);   for(i=0;i<n;i++)	{	 c=toascii(k);	 fread(&com.name,sizeof(com.name),1,f);	 fread(&com.size,sizeof(com.size),1,f);	 fread(&com.hex,sizeof(com.hex),1,f);	 if(com.size[0]==c)            {	    fwrite(&com,sizeof(com),1,f1);	    printf("%s",&com.name);	    gotoxy(15,wherey());	    printf("%s",&com.size);	    gotoxy(18,wherey());	    printf("%s/n",com.hex);            }	}  } fcloseall(); cputs("Обработка завершена..."); getch();}
开发者ID:majioa,项目名称:majioa-master-deg-n-thesis,代码行数:51,


示例22: replace_space

/** * @brief *	Given a string str, converts instances of ' ' (space) with the repl string. *	Also, if the first character in repl string appears in str, then that is *	replaced with '%<hex_num>' where <hex_num> is the ascii hex represetation of *	that character. * *	This returns a statically allocated area. *	For example, the function call *	"replace_space("ap%ple banana", "%20") *	results in ap%25ple%20banana *	for %25 = %, and %20 = <space>. * *	Special Case: if rep string is given as "", then the returned string will *	be quoted if a space character is found. */char *replace_space(char *str, char *repl){	static char rstr[512];	static char rstr2[512];	int	i, j;	int	repl_len;	char	spec_chars[4];	char	spec_len;	int	has_space = 0;	if (str == NULL || repl == NULL)		return NULL;	repl_len = strlen(repl);	sprintf(spec_chars, "%%%02d", toascii(repl[0]));	spec_len = strlen(spec_chars);	i = 0;	while (*str != '/0') {		if (*str == repl[0]) {			for (j=0; j< spec_len; j++, i++) {				rstr[i] = spec_chars[j];			}		} else if (*str == ' ' && repl_len > 0) {			for (j=0; j< repl_len; j++, i++) {				rstr[i] = repl[j];			}		} else {			rstr[i] = *str;			i++;		}		if (*str == ' ')			has_space = 1;		str++;	}	rstr[i] = '/0';	if (repl_len == 0 && has_space) {		sprintf(rstr2, "/"%s/"", rstr);		return (rstr2);	}	return (rstr);}
开发者ID:Bhagat-Rajput,项目名称:pbspro,代码行数:63,


示例23: typeconv

/* * Convert a character to displayable format, returns true when we fill a * display-line. */static inttypeconv(int c){    char dot = (char) (OptStripped ? ' ' : '.');    if (OptBinary) {		/* highlight chars with parity */	if (!isascii(c)) {	    c = toascii(c);	    if (OptStripped) {		if (!isprint(c))		    c = ' ';	    } else if (Tcol < (int) END_COL)		Text[Tcol] = '_';	}    }    if (isascii(c)) {	if (OptBinary && !isprint(c)) {	    typeover(dot);	} else if (c == '/b') {	    if (Tcol > 0)		Tcol--;	} else if (c == '/r') {	    Tcol = 0;	} else if (isprint(c)) {	    typeover(c);	} else if (isspace(c)) {	    if (c == '/n') {		while (Tlen > 0		       && isspace(UCH(Text[Tlen - 1])))		    Tlen--;		return (TRUE);	    } else if (c == '/t') {		typeover(' ');		while (Tcol % tabstop)		    typeover(' ');	    }	} else {	    typeover(dot);	}    } else if (OptBinary) {	typeover(dot);    }    if (OptBinary)	if (Tlen - Shift >= COLS)	    return (TRUE);    return (FALSE);}
开发者ID:ThomasDickey,项目名称:ded-snapshots,代码行数:51,


示例24: ui_calculateHashIndex

/*Function Name: ui_calculateHashIndexDescription: It takes the fileName to be hashed and calculates the hash index             for the hash table.Parameters: It takes the fileName as the parameterReturn Type: It returns the hash index*/unsigned int ui_calculateHashIndex(char *fileName){    char c_firstCharacter = '/0';    unsigned int ui_index = 0;    c_firstCharacter = *fileName;    ui_index = toascii(toupper(c_firstCharacter));    ui_index = ui_index - 65;    if(ui_index < 0 || ui_index > 25){         ui_index = 26;    }    return ui_index;}
开发者ID:sn3g14,项目名称:virtual-file-system,代码行数:24,


示例25: hexdump

void hexdump(unsigned char *buf, int nbytes){	int i, j;	for (i = 0; i < nbytes; i += 16) {		printf("%04X : ", i);		for (j = 0; j < 16 && i + j < nbytes; j++)			printf("%2.2X ", buf[i + j]);		for (; j < 16; j++) {			printf("   ");		}		printf(": ");		for (j = 0; j < 16 && i + j < nbytes; j++) {			char c = toascii(buf[i + j]);			printf("%c", isalnum(c) ? c : '.');		}		printf("/n");	}}
开发者ID:rjrpaz,项目名称:MyOpenMPI,代码行数:19,


示例26: vputc

static voidvputc(unsigned char ch){	int meta;	if (!isprint(ch) && !isascii(ch)) {		(void)putchar('M');		(void)putchar('-');		ch = toascii(ch);		meta = 1;	} else		meta = 0;	if (isprint(ch) || (!meta && (ch == ' ' || ch == '/t' || ch == '/n')))		(void)putchar(ch);	else {		(void)putchar('^');		(void)putchar(ch == '/177' ? '?' : ch | 0100);	}}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:19,


示例27: main

int main(void){   char c;   puts("Give me a char");   c = getchar();   putchar('/n');   /* Start the comparision */   printf("%c %s an alpha character (%u)/n",      c, isalpha((int)c) ? "is" : "is not", isalpha((int)c));   printf("%c %s an upper character (%u)/n",      c, isupper((int)c) ? "is" : "is not", isupper((int)c));   printf("%c %s a lower character (%u)/n",      c, islower((int)c) ? "is" : "is not", islower((int)c));   printf("%c %s a digit character (%u)/n",      c, isdigit((int)c) ? "is" : "is not", isdigit((int)c));   printf("%c %s a hex digit character (%u)/n",      c, isxdigit((int)c) ? "is" : "is not", isxdigit((int)c));   printf("%c %s an alnum character (%u)/n",      c, isalnum((int)c) ? "is" : "is not", isalnum((int)c));   printf("%c %s a space character (%u)/n",      c, isspace((int)c) ? "is" : "is not", isspace((int)c));   printf("%c %s a punctuation character (%u)/n",      c, ispunct((int)c) ? "is" : "is not", ispunct((int)c));   printf("%c %s a printer character (%u)/n",      c, isprint((int)c) ? "is" : "is not", isprint((int)c));   printf("%c %s a graphic character (%u)/n",      c, isgraph((int)c) ? "is" : "is not", isgraph((int)c));   printf("%c %s a control character (%u)/n",      c, iscntrl((int)c) ? "is" : "is not", iscntrl((int)c));   printf("%c %s a blank character (%u)/n",      c, isblank((int)c) ? "is" : "is not", isblank((int)c));   printf("%c %s an ASCII character (%u)/n",      c, isascii((int)c) ? "is" : "is not", isascii((int)c));   printf("%c to upper is %c/n", c, toupper((int)c));   printf("%c to lower is %c/n", c, tolower((int)c));   printf("%c to ASCII is %c/n", c, toascii((int)c));   return 0;} /* E0F main */
开发者ID:clamiax,项目名称:misc,代码行数:42,


示例28: main

int main(){    char str[100];    int l,flag,asciiflag,i,c_flag;    level:    while((scanf("%s",str))){    if(strcmp(str,"end")==0)    break;    flag=0;    asciiflag=0;    c_flag=0;    l=strlen(str);    for(i=0;i<l;i++)    {        if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')        {            flag++;        }        if(str[i]==str[i-1])        {            c_flag++;            if(c_flag>1){            printf("<%s> is not acceptable./n",str);            goto level;            }        }        if(str[i]==toascii(str[i])+1)        {            asciiflag++;            if(asciiflag==2) {                printf("<%s> is not acceptable./n",str);                goto level;            }        }    }    if(flag>0&&c_flag==0&&asciiflag<2) printf("<%s> is acceptable./n",str);    else printf("<%s> is not acceptable./n",str);    }    return 0;}
开发者ID:habibruetian12,项目名称:Online-Judge-Codes,代码行数:41,


示例29: fn_printn

/* * Print out a counted filename (or other ascii string). * If ep is NULL, assume no truncation check is needed. * Return true if truncated. */intfn_printn(register const u_char *s, register u_int n,	  register const u_char *ep){	register u_char c;	while (n > 0 && (ep == NULL || s < ep)) {		n--;		c = *s++;		if (!isascii(c)) {			c = toascii(c);			putchar('M');			putchar('-');		}		if (!isprint(c)) {			c ^= 0x40;	/* DEL to ?, others to alpha */			putchar('^');		}		putchar(c);	}	return (n == 0) ? 0 : 1;}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:27,



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


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