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

C++ prints函数代码示例

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

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



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

示例1: printf

void printf(const char *format, ...)
{
       uint32 *arg;
       arg = &format;
       int c;
       char buf[64];
       arg++;
       while ((c = *format++) != 0)
         {
           if (c != '%')
             putc(c);
           else if(c == '%')
             {
               char *p;
     
               c = *format++;
               switch (c)
                 {
                 case 'd':
                 case 'u':
                 case 'x':
                   itoa(buf, *arg++);
                   prints(buf);
		   break;
		 case 'c':
		   changeColor(*((int*)arg++));
		   break;
		 case 's':
                   p = *arg++;
                   if (! p)
                     p = "(null)";
     
                 string:
                   while (*p)
                     putc(*p++);
                   break;
     
                 default:
                   putc(*((int *) arg++));
                   break;
                 }
             }
	}
}
开发者ID:cxleb,项目名称:cx,代码行数:44,代码来源:textscreen.c


示例2: sa_check_expect_file_line

bool sa_check_expect_file_line(const char *file, const char *function, int line, Array a, String *e, int ne) {
	base_init();
	base_count_check();
	if (a->n != ne) {
		printf("%s, line %d: Actual length %d "
			"differs from expected length %d\n", file, line, a->n, ne);
		return false;
	}
	if (a->s != sizeof(String)) {
		printf("%s, line %d: Actual element size %d "
			"differs from expected element size %lu\n", file, line, a->s, (unsigned long)sizeof(String));
		return false;
	}
	if (a->n < 0) {
		printf("%s, line %d: Invalid lengths %d\n", file, line, a->n);
		return false;		
	}
	if (ne < 0) {
		printf("%s, line %d: Invalid lengths %d\n", file, line, ne);
		return false;		
	}
	if (a->n > 0 && a->a == NULL) {
		printf("%s, line %d: Actual value array is NULL\n", file, line);
		return false;		
	}
	if (ne > 0 && e == NULL) {
		printf("%s, line %d: Expected value array is NULL\n", file, line);
		return false;		
	}
	String *sa = a->a;
	for (int i = 0; i < a->n; i++) {
		if (!s_equals(sa[i], e[i])) {
			printf("%s, line %d: Actual value ", file, line);
			printsa(sa, a->n);
			prints(" differs from expected value ");
			printsa(e, ne);
			printf(" at index %d.\n", i);
			return false;
		}
	}
	printf("%s, line %d: check passed\n", file, line);
	base_count_success();
	return true;
}
开发者ID:qwertzuiop961,项目名称:programmieren,代码行数:44,代码来源:string_array.c


示例3: pad_view

int
pad_view()
{
  int fd, count;
  Pad *pad;

  if ((fd = open(FN_RUN_NOTE_PAD, O_RDONLY)) < 0)
    return XEASY;

  count = 0;
  mgets(-1);

  for (;;)
  {
    pad = mread(fd, sizeof(Pad));
    if (!pad)
    {
      vmsg(NULL);
      break;
    }
    else if (!(count % 5))    /* itoc.020122: 有 pad 才印 */
    {
      clear();
      move(0, 23);
      prints("【 酸 甜 苦 辣 留 言 板 】        第 %d 頁\n\n", count / 5 + 1);
    }

    outs(pad->msg);
    count++;

    if (!(count % 5))
    {
      move(b_lines, 0);
      outs("請按 [SPACE] 繼續觀賞,或按其他鍵結束: ");

      /* itoc.010127: 修正在偵測左右鍵全形下,按左鍵會跳離二層選單的問題 */
      if (vkey() != ' ')
        break;
    }
  }

  close(fd);
  return 0;
}
开发者ID:guessi,项目名称:easttownbbs,代码行数:44,代码来源:menu.c


示例4: init

static int init(void) 
{
	int cnt = 0;
#ifdef LWIP_STATS
	int stats_cnt = 0;
#endif

	lock_static_init(&net_lock);
	/* printc("netlock id %d\n", net_lock.lock_id); */
	NET_LOCK_TAKE();

	torlib_init();
	net_conn_init();
	cos_net_create_netif_thd();
	init_lwip();

	NET_LOCK_RELEASE();
	/* Start the tcp timer */
	while (1) {
		/* Sleep for a quarter of seconds as prescribed by lwip */
		NET_LOCK_TAKE();

		if (++cnt == 4) {
#ifdef TEST_TIMING
			timing_output();
#endif
		}
#ifdef LWIP_STATS
		if (++stats_cnt == 20) {
			stats_cnt = 0;
			stats_display();
		}
#endif
		tcp_tmr();
		NET_LOCK_RELEASE();
		timed_event_block(cos_spd_id(), 25); /* expressed in ticks currently */
		/* printc("use timer to tcp debug thread here...\n"); */
		cos_mpd_update();
	}

	prints("net: Error -- returning from init!!!");
	BUG();
	return 0;
}
开发者ID:songjiguo,项目名称:Monitor_ML,代码行数:44,代码来源:cos_net.c


示例5: main

int main(int argc, char **argv) {
    if (argc < 3) {
        prints("Usage: fstest <filename> <n>\n");
        return 1;
    } 

    int blocksize = MAX_BLOCK_SIZE;

    char *filename = argv[1];
    int filesize = atoi(argv[2]);
    if (blocksize > MAX_BLOCK_SIZE) {
        prints("Blocksize must be smaller!\n");
        return 1;
    }

    
    int filehandle = syscall_open(filename);
    if (filehandle < 0) {
        prints("failed to open file!\n");
        return 3;
    }
    
    int written = 0;
    while(written < filesize) {
        int i;
        int write = MIN(filesize - written, blocksize);
        for (i = 0; i < write; i++) {
            buffer[i] = char_for_pos(written + i);
        }
        write = syscall_write(filehandle, (void*)&buffer, write);
        if (write <= 0) {
            prints("failed to write!\n");
            return 3;
        }
        written += write;
    }
    prints("OK, fstest wrote bytes. closing file\n");
    if(syscall_close(filehandle) == -1) {
        prints("OK, fstest file close failed\n");
        return 1;
    }
    
    prints("OK, fstest closed file\n");

    return 0;
}
开发者ID:joux3,项目名称:operating_systems_project,代码行数:46,代码来源:writetest.c


示例6: printResults

// Displays Game Results
void printResults() {
	prints(0, 15, YELLOW, BLACK, "GAME OVER", 1);
	
	if(game.myScore > game.oppScore) {
		prints(0, 15, YELLOW, BLACK, "You won!", 1);
		prints(0, 15, YELLOW, BLACK, "Your Score: ", 1);
		integerprint(0, 15, YELLOW, BLACK, game.myScore);
		prints(WHITE, BLACK, "Opponent Score: ");
		integerprint(WHITE, BLACK, game.oppScore);
	} else {
		prints(0, 15, RED, BLACK, "You lost", 1);
		prints(0, 15, WHITE, BLACK, "Your Score: ");
		integerprint(0, 15, WHITE, BLACK, game.myScore);
		prints(0, 15, YELLOW, BLACK, "Opponent Score: ");
		integerprint(0, 15, YELLOW, BLACK, game.oppScore);
	}
}
开发者ID:horsetailfiddlehead,项目名称:ee478,代码行数:18,代码来源:game.c


示例7: cos_init

void cos_init(void *arg)
{
	static volatile int first = 1;
	
	union sched_param sp;
	pnums = avg = 0;
	inc1 = inc2 = 0;

#ifdef DEBUG_PERIOD	
	unsigned long cos_immediate_process_cnt_prev = 0;

	if (cos_get_thd_id() == debug_thd) {
		if (periodic_wake_create(cos_spd_id(), 100)) BUG();
		while(1) {
			periodic_wake_wait(cos_spd_id());
			printc("num interrupt_wait %ld interrupt_process %ld\n", 
			       interrupt_wait_cnt, interrupt_process_cnt);
			interrupt_wait_cnt = 0;
			interrupt_process_cnt = 0;
			if (cos_immediate_process_cnt > 0) {
				printc("num immediate interrupt_process %ld\n", 
				       cos_immediate_process_cnt - cos_immediate_process_cnt_prev);
				cos_immediate_process_cnt_prev = cos_immediate_process_cnt;
			}

		}
	}
#endif
	
	if (first) {
		first = 0;

#ifdef DEBUG_PERIOD		
		sp.c.type = SCHEDP_PRIO;
		sp.c.value = 10;
		debug_thd = sched_create_thd(cos_spd_id(), sp.v, 0, 0);
#endif

		init();
	} else {
		prints("net: not expecting more than one bootstrap.");
	}
}
开发者ID:songjiguo,项目名称:C3,代码行数:43,代码来源:netif.c


示例8: _debug_print_ibuffer

/*
 * These are for terminal keys debug
 */
void
_debug_print_ibuffer()
{
    static int y = 0;
    int i = 0;

    move(y % b_lines, 0);
    for (i = 0; i < t_columns; i++) 
	outc(' ');
    move(y % b_lines, 0);
    prints("%d. Current Buffer: %d/%d, ", y+1, icurrchar, ibufsize);
    outs(ANSI_COLOR(1) "[" ANSI_RESET);
    for (i = 0; i < ibufsize; i++)
    {
	int c = (unsigned char)inbuf[i];
	if(c < ' ')
	{
	    prints(ANSI_COLOR(1;33) "0x%02x" ANSI_RESET, c);
	} else {
开发者ID:hrs113355,项目名称:Maple-XDBBS,代码行数:22,代码来源:io.c


示例9: online_users_query

static tui_list_query_t online_users_query(tui_list_t *p)
{
	online_users_t *up = p->data;
	online_user_info_t *ip = up->users + p->cur;
	p->in_query = true;

	t_query(ip->name);
	screen_move(-1, 0);
	//% prints("\033[0;1;37;44m聊天[\033[1;32mt\033[37m] 寄信[\033[1;32mm\033[37m] "
	prints("\033[0;1;37;44m\xc1\xc4\xcc\xec[\033[1;32mt\033[37m] \xbc\xc4\xd0\xc5[\033[1;32mm\033[37m] "
			//% "送讯息[\033[1;32ms\033[37m] 加,减朋友[\033[1;32mo\033[37m,\033[1;32md\033[37m] "
			"\xcb\xcd\xd1\xb6\xcf\xa2[\033[1;32ms\033[37m] \xbc\xd3,\xbc\xf5\xc5\xf3\xd3\xd1[\033[1;32mo\033[37m,\033[1;32md\033[37m] "
			//% "选择使用者[\033[1;32m↑\033[37m,\033[1;32m↓\033[37m] "
			"\xd1\xa1\xd4\xf1\xca\xb9\xd3\xc3\xd5\xdf[\033[1;32m\xa1\xfc\033[37m,\033[1;32m\xa1\xfd\033[37m] "
			//% "求救[\033[1;32mh\033[37m]");
			"\xc7\xf3\xbe\xc8[\033[1;32mh\033[37m]");
	screen_flush();
	return DONOTHING;
}
开发者ID:fbbs,项目名称:fbbs,代码行数:19,代码来源:online.c


示例10: main

int main()
{
	int n, d;
	int i, j;

	for(i = 0; i < 100; i++)
		for(j = 0; j < 160; j++) {
			m[i][j] = 0;
		}
	calc();

	scanf("%d", &n);

	for(i = 0; i < n; i++) {
		scanf("%d", &d);
		prints(d);
	}
	return 0;
}
开发者ID:alvinrxg,项目名称:spoj,代码行数:19,代码来源:p24_1.c


示例11: kps

int kps()
{
  int i;
  for (i=0; i<NPROC; i++){
    printf("Task %d ", i+1);
      printf("ppid="); 
         if (i>0) prints("  ");
         if (proc[i].status)
	   printf("%d", proc[i].ppid); 
         else
            printf("--");
         if (running==&proc[i])
	   printf("%s", "  RUNNING");
         else
	   printf("  %s",pStatus[proc[i].status]);
      printf("\n");
  }
  return(0);
}
开发者ID:B-Rich,项目名称:CptS460,代码行数:19,代码来源:int.c


示例12: main

//The idea, here, is that we'll have a pre-populated list of function pointers
//to functions which take a current position in a string, the string itself, and
//attempt to turn the segment following the current position into the particular
//type of token/ast_node which that function handles. If it fails, it returns
//that it read nothing and the loop tries applying the next function until it
//runs out of functions.
//The functions are also responsible for updating the current line/column
//position in the source string
int main(void) {
	
	//In real life, we'll read this in from a file
	unsigned char code[] = "6-((12+5)/3)"; 
	unsigned int code_length = strlen(code);
	unsigned int cur_location = 0;
	unsigned int chars_consumed = 0;
	ast_node* active_node = (ast_node*)0;
	unsigned int cur_line = 1;
	unsigned int cur_column = 1;
	
	while(cur_location < code_length) {
		
		//Iterate through all the factory functions for 
		for(i = 0; i < node_builder_count; i++) {
		
			//Try to use a factory function on the stream
			chars_consumed = build_node[i](active_node, &cur_line, &cur_column, code, cur_location);
			
			//If we were able to interpret any of the stream, we're done
			if(chars_consumed)
				break;
		}
		
		if(!chars_consumed) {
			
			//If we iterated through all of the node builders and none of them
			//could complete any work, then we know we had a syntax error
			printf("The system encountered a syntax error and will quit.\n");
			break;
		}
		
		cur_location += chars_consumed;
	}
	
	//Here, if the entire string was consumed we would proceed on to parsing
	//the AST tree we just generated
	
	//Can probably get rid of this, but why not
	prints("Done.\n");
	
	return 0;
}
开发者ID:JMarlin,项目名称:P5-Redux,代码行数:51,代码来源:ast.c


示例13: print_card

static int print_card(int card,int x,int y)
{
  char *flower[4]={"¢á","¢Ö","¢Ò","¢Ñ"};
  char *poker[52]={"¢Ï","¢Ï","¢Ï","¢Ï","¢±","¢±","¢±","¢±","¢²","¢²","¢²","¢²",
                   "¢³","¢³","¢³","¢³","¢´","¢´","¢´","¢´","¢µ","¢µ","¢µ","¢µ",
                   "¢¶","¢¶","¢¶","¢¶","¢·","¢·","¢·","¢·","¢¸","¢¸","¢¸","¢¸",
                   "10","10","10","10","¢Ø","¢Ø","¢Ø","¢Ø","¢ß","¢ß","¢ß","¢ß",
                   "¢Ù","¢Ù","¢Ù","¢Ù"};

move(x,y);   prints("¢~¢w¢w¢w¢¡");
move(x+1,y); prints("¢x%s    ¢x",poker[card]);
move(x+2,y); prints("¢x%s    ¢x",flower[card%4]);
move(x+3,y); prints("¢x      ¢x");
move(x+4,y); prints("¢x      ¢x");
move(x+5,y); prints("¢x      ¢x");
move(x+6,y); prints("¢¢¢w¢w¢w¢£");
return 0;
}
开发者ID:yrchen,项目名称:Athena,代码行数:18,代码来源:bj.c


示例14: show_pipe

int show_pipe(PIPE *p){
  int i,j;

  printf("------------ PIPE CONTENTS ------------\n");
  printf("nreader=%d  nwriter=%d  ", p->nreader, p->nwriter);
  printf("data=%d  room=%d\n", p->data, p->room);

  prints("contents=>");

  if(p->data){
    j = p->tail;

    for(i =0; i < p->data; i++){
      putc(p->buf[j++]);
      j = j % PSIZE;
    }
  }

  printf("<\n----------------------------------------\n");
}
开发者ID:tymicruz,项目名称:CuatroSeisZero,代码行数:20,代码来源:pipe.c


示例15: monitor_refresh

void
monitor_refresh(sig)
{
  int i, boottime;
  if (sig) signal(sig, SIG_IGN);
  boottime = myinfo.idletimeout*120;
  if (boottime && ((monitor_idle += MONITOR_REFRESH) > boottime)) {
    disconnect(EXIT_TIMEDOUT);
  }
  if (bbs_check_mail()) {
    move(0, t_columns/3);
    prints("(You have mail.)");
  }
  DoShortUserList();
  for (i=0; i<global_ulist_sz; i++)
    if (!global_ulist[i].found) global_ulist[i].active = 0;

  signal(SIGALRM, monitor_refresh);
  alarm(MONITOR_REFRESH);
}
开发者ID:catskillmarina,项目名称:eBBS,代码行数:20,代码来源:c_users.c


示例16: printf

int printf(char *format, ...)
{
	int width, pad;
	int pc = 0;
	char scr[2];
	 va_list args;
	 va_start(args, format);
	 for (; *format != 0; ++format) 
	 {
	      if (*format == '%') 
	      {
	             ++format;
	             width = pad = 0;
	             if (*format == '\0') break;
	             if (*format == '%') goto out;
	             /*if (*format == '-') 
	             {
	                   ++format;
	                   pad = PAD_RIGHT;
	             }
	             while (*format == '0') 
	             {
	                   ++format;
	                   pad |= PAD_ZERO;
	             }*/
	             for ( ; *format >= '0' && *format <= '9'; ++format) 
	             {
	                    width *= 10;
	                   width += *format - '0';
	             }
	             if( *format == 's' )
	             {
	                   char *s = (char *)va_arg( args, int );
	                   pc += prints (s?s:"(null)", width, pad);
	                   continue;
	             }
	             if( *format == 'd' ) 
	             {
	                   pc += printi (va_arg( args, long int ), 10, 1, width, pad, 'a');
	                   continue;
	             }
开发者ID:danysantiago,项目名称:wave-sphere,代码行数:41,代码来源:print.c


示例17: periodic_wake_wait

int periodic_wake_wait(spdid_t spdinv)
{
	spdid_t spdid = cos_spd_id();
	struct thread_event *te;
	u16_t tid = cos_get_thd_id();
	long long t;

	TAKE(spdid);
	te = te_pget(tid);
	if (NULL == te) BUG();
	if (!(te->flags & TE_PERIODIC)) goto err;
		
	assert(!EMPTY_LIST(te, next, prev));
	te->flags |= TE_BLOCKED;

	rdtscll(t);
	if (te->missed) {	/* we're late */
		long long diff;
		assert(te->completion);

		diff = (t - te->completion);
		te->lateness_tot += diff;
		//te->samples++;
		te->miss_lateness_tot += diff;
		//te->miss_samples++;
		
		te->completion = 0;
	} else {		/* on time! */
		te->completion = t;
	}
	RELEASE(spdid);

	if (-1 == sched_block(spdid, 0)) {
		prints("fprr: sched block failed in timed_event_periodic_wait.");
	}

	return 0;
err:
	RELEASE(spdid);
	return -1;
}
开发者ID:wittrock,项目名称:CompositeOS_Project,代码行数:41,代码来源:timed_event.c


示例18: print

static int print(int limit, char * *out, const char *format, va_list args)
{
    register int width, pad;
    register int pc = limit;
    char scr[2];

    for (; *format != 0 && pc; ++format) {
        if (*format == '%') {
            ++format;
            width = pad = 0;
            if (*format == '\0') {
                break;
            }
            if (*format == '%') {
                goto out;
            }
            if (*format == '-') {
                ++format;
                pad = PAD_RIGHT;
            }
            while (*format == '0') {
                ++format;
                pad |= PAD_ZERO;
            }
            for (; *format >= '0' && *format <= '9'; ++format) {
                width *= 10;
                width += *format - '0';
            }
            if (*format == 's') {
                register char *s = (char *)va_arg(args, int);
                pc -= prints(out, s ? s : "(null)", width, pad, pc);
                continue;
            }
            if (*format == 'd') {
                pc -= printi(out, va_arg(args, int), 10, 1, width, pad, 'a', pc);
                continue;
            }
            if (*format == 'x') {
                pc -= printi(out, va_arg(args, int), 16, 0, width, pad, 'a', pc);
                continue;
            }
开发者ID:passedaway,项目名称:misc,代码行数:41,代码来源:printf-stdarg.c


示例19: print

static int print(char **out, const char *format, va_list args )
{
    int width, pad;
    int pc = 0;
    char scr[2];

    for (; *format != 0; ++format) {
        if (*format == '%') {
            ++format;
            width = pad = 0;
            if (*format == '\0') break;
            if (*format == '%') goto out;
            if (*format == '-') {
                ++format;
                pad = PAD_RIGHT;
            }

            while ((*format == 'h') || (*format == 'l'))
                ++format;

            while (*format == '0') {
                ++format;
                pad |= PAD_ZERO;
            }
            for ( ; *format >= '0' && *format <= '9'; ++format) {
                width *= 10;
                width += *format - '0';
            }
            if( *format == 's' ) {
                register char *s = (char *)va_arg( args, int );
                pc += prints (out, s?s:"(null)", width, pad);
                continue;
            }
            if( *format == 'd' ) {
                pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a');
                continue;
            }
            if( *format == 'x' || *format == 'p') {
                pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a');
                continue;
            }
开发者ID:insane-adding-machines,项目名称:frosted,代码行数:41,代码来源:kprintf.c


示例20: win_sort

int win_sort() {
    int n, n2, tmp;
    char tmpID[20];
    screen_clear();
    //% prints("祝贺! 您刷新了自己的纪录!\r\n");
    prints("\xd7\xa3\xba\xd8! \xc4\xfa\xcb\xa2\xd0\xc2\xc1\xcb\xd7\xd4\xbc\xba\xb5\xc4\xbc\xcd\xc2\xbc!\r\n");
    pressanykey();
    for(n=0; n<=18; n++)
    for(n2=n+1; n2<=19; n2++)
    if(topT[n]> topT[n2]) {
        tmp= topT[n];
        topT[n]= topT[n2];
        topT[n2]= tmp;
        strcpy(tmpID, topID[n]);
        strcpy(topID[n], topID[n2]);
        strcpy(topID[n2], tmpID);
        strcpy(tmpID, topFROM[n]);
        strcpy(topFROM[n], topFROM[n2]);
        strcpy(topFROM[n2], tmpID);
    }
}
开发者ID:caidongyun,项目名称:fbbs,代码行数:21,代码来源:winmine.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ printstr函数代码示例发布时间:2022-05-30
下一篇:
C++ printout函数代码示例发布时间: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