当前位置: 首页>>代码示例>>C++>>正文


C++ cputc函数代码示例

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


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

示例1: update_data

void update_data(void){
	unit++;
	lastime++;
	if (unit >= Freq){
		unit = 0;
		cnt = cnt + 1 ;

		if (cnt >= 9){
			cnt = 0;
			level ++;
			}
		
		if (level < 10) cputint(level, 7, 30, white);
		else cputint(level, 7, 29, white);

		sec++; 
		if (sec >= 60){
			sec = 0;
			min++;
			}
 		if (min < 10){
			cputc('0', 10, 27, white);
			cputint(min, 10, 28, white);
			}
		else cputint(min, 10, 27, white);

		cputc(':', 10, 29, white);
		if (sec < 10){
			cputc('0', 10, 30, white);
			cputc(sec+'0', 10, 31, white);
		}
		else cputint(sec, 10, 30, white);
	}
}
开发者ID:archeart,项目名称:Game-Downstairs,代码行数:34,代码来源:game.c

示例2: code

/* the only characters that have special meaning in a code block are
 * `<' and `&' , which are /always/ expanded to &lt; and &amp;
 */
static void
code(int escape, MMIOT *f)
{
    int c;

    if ( escape && (peek(f,1) == ' ') )
	shift(f,1);

    while ( (c = pull(f)) != EOF ) {
	switch (c) {
	case ' ':   if ( peek(f,1) == '`' && endofcode(escape, 1, f) )
			return;
		    Qchar(c, f);
		    break;

	case '`':   if ( endofcode(escape, 0, f) )
			return;
		    Qchar(c, f);
		    break;

	case '\\':  cputc(c, f);
		    if ( peek(f,1) == '>' || (c = pull(f)) == EOF )
			break;
	
	default:    cputc(c, f);
		    break;
	}
    }
} /* code */
开发者ID:gensym,项目名称:markdownlive,代码行数:32,代码来源:generate.c

示例3: drawBox

void __fastcall drawBox(
	unsigned char x,
	unsigned char y,
	unsigned char w,
	unsigned char h,
	unsigned char color,
	unsigned reverse)
{
	unsigned char i;
	
	//textcolor(color);
	revers(reverse);

	// draw frame
#ifdef __APPLE2ENH__	
	textframexy(x, y, w + 1, h + 1, TEXTFRAME_TALL);
#else
	for(i=x+w-1; i>x; i--)
	{
		gotoxy(i, y); cputc('-');
		gotoxy(i, y+h); cputc('-');
	}
	for(i=y+h-1; i>y; i--)
	{
		gotoxy(x, i); cputc('!');
		if(x+w < size_x)
			gotoxy(x+w, i); cputc('!');
	}
#endif
        // draw body
	for(i=y+1; i<y+h; ++i)
	{
		cclearxy(x + 1, i, w - 1);
	}
}
开发者ID:A2Command,项目名称:a2command,代码行数:35,代码来源:screen.c

示例4: main

int main (void)
{
    unsigned char XSize, YSize;

    /* Set screen colors */
    (void) textcolor (COLOR_WHITE);
    (void) bordercolor (COLOR_BLACK);
    (void) bgcolor (COLOR_BLACK);

    /* Clear the screen, put cursor in upper left corner */
    clrscr ();

    /* Ask for the screen size */
    screensize (&XSize, &YSize);

    /* Draw a border around the screen */

    /* Top line */
    cputc (CH_ULCORNER);
    chline (XSize - 2);
    cputc (CH_URCORNER);

    /* Vertical line, left side */
    cvlinexy (0, 1, YSize - 2);

    /* Bottom line */
    cputc (CH_LLCORNER);
    chline (XSize - 2);
    cputc (CH_LRCORNER);

    /* Vertical line, right side */
    cvlinexy (XSize - 1, 1, YSize - 2);

    /* Write the greeting in the mid of the screen */
    gotoxy ((XSize - strlen (Text)) / 2, YSize / 2);
    cprintf ("%s", Text);

#if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__) || defined(__ATARI5200__)

    /* Wait for the user to press a button */
    joy_install (joy_static_stddrv);
    while (!joy_read (JOY_1)) ;
    joy_uninstall ();

#else

    /* Wait for the user to press a key */
    cgetc ();

#endif

    /* Clear the screen again */
    clrscr ();

    /* Done */
    return EXIT_SUCCESS;
}
开发者ID:cc65,项目名称:cc65,代码行数:57,代码来源:hello.c

示例5: DrawFrame

static void DrawFrame (register FrameDesc* F, char Active)
/* Draw one window frame */
{
    TextDesc* T;
    unsigned char Count;
    unsigned char tl, tr, bl, br;
    unsigned char x1, y1, width;
    unsigned char OldColor;

    /* Determine the characters for the corners, set frame color */
    if (Active) {
        OldColor = textcolor (COLOR_FRAMEHIGH);
        tl = CH_ULCORNER;
        tr = CH_URCORNER;
        bl = CH_LLCORNER;
        br = CH_LRCORNER;
    } else {
        OldColor = textcolor (COLOR_FRAMELOW);
        tl = F->fd_tl;
        tr = F->fd_tr;
        bl = F->fd_bl;
        br = F->fd_br;
    }

    /* Get the coordinates into locals for faster access */
    x1 = F->fd_x1;
    y1 = F->fd_y1;
    width = F->fd_width;

    /* Top line */
    cputcxy (x1, y1, tl);
    chline (width);
    cputc (tr);

    /* Left line */
    cvlinexy (x1, ++y1, F->fd_height);

    /* Bottom line */
    cputc (bl);
    chline (width);
    cputc (br);

    /* Right line */
    cvlinexy (F->fd_x2, y1, F->fd_height);

    /* If the window has static text associated, print the text */
    (void) textcolor (COLOR_TEXTLOW);
    Count = F->fd_textcount;
    T = F->fd_text;
    while (Count--) {
        cputsxy (x1 + T->x, y1 + T->y, T->text);
        ++T;
    }

    /* Set the old color */
    (void) textcolor (OldColor);
}
开发者ID:AntiheroSoftware,项目名称:cc65,代码行数:57,代码来源:dbg.c

示例6: fmt_print

// helper function to put the string out - string will be modified and is
// expected to be 256 chars in length
int fmt_print(char *s, int zero, int width, int left, int precis, int plus) {
    int cnt = 0;
    int i = strlen(s);
    int pad = ' ';
    if (zero) pad = '0';

    if ((precis > 0) && (i >= precis)) {
        i = precis;
        if (plus) --i;
    }
    if ((plus) && (width > 0)) --width;
    if (width <= 0) {
        if (plus) {
            cputc('+');
            ++cnt;
        }
        for (int idx=0; idx<i; ++idx) {
            cputc(*(s++));
            ++cnt;
        }
    } else {
        if (left) {
            if (plus) {
                cputc('+');
                ++cnt;
            }
            for (int idx=0; idx<i; ++idx) {
                cputc(*(s++));
                ++cnt;
            }
            for (int idx=0; idx<width-i; ++idx) {
                cputc(' ');
                ++cnt;
            }
        } else {
            if ((plus)&&(zero)) {
                cputc('+');
                plus = 0;
                ++cnt;
            }
            for (int idx=0; idx<width-i; ++idx) {
                cputc(pad);
                ++cnt;
            }
            if (plus) {
                cputc('+');
                ++cnt;
            }
            for (int idx=0; idx<i; ++idx) {
                cputc(*(s++));
                ++cnt;
            }
        }
    }
    return cnt;
}
开发者ID:tursilion,项目名称:libti99,代码行数:58,代码来源:conio_cprintf.c

示例7: stack_size

void
stack_size(void)
{
  static unsigned char *c;
  static unsigned int s;
  c = (unsigned char *)(0xBF00 - STACK_SIZE);
  while(*c++ == 0xA2) {
  }
  s = (unsigned char *)0xBF00 - c;
  clrscr();
  cputc('0' + s / 100 % 10);
  cputc('0' + s / 10  % 10);
  cputc('0' + s       % 10);
  cgetc();
}
开发者ID:ZhepingYang,项目名称:contiki-1.x,代码行数:15,代码来源:main.c

示例8: testCPeekC

/* test which outputs every possible char, reads it back 
** from screen memory, outputs again at the next char position
** and compares the two screen memory bytes on identity 
*/
int testCPeekC(char ch){

    /* Test the given charcode on special characters NEWLINE,LINEFEED and
    ** TAB
    */
    if ( ('\n' !=ch) && ('\r' !=ch) && ('\t' != ch) ){ 
        /* go on if not special char according to prev comment */
        unsigned char ch2_a, ch2_b;
        
        /* output char to the screen */
        cputc(ch);
        
        /* move cursorpos to previous output */
        chBack();
        /* get back written char including the translation scrcode->asc */
        ch2_a = cpeekc();
        /* get back written char without translation */
        ch2_b = peekChWithoutTranslation();
        
        /* move cursor to following writing position */
        chForth();
        /* output again the char which was read back by cpeekc */
        cputc(ch2_a);
        
        /* move cursorpos to previous output */
        chBack();
        
        /* get back second written char without translation and compare it to
        ** the previously written char without translation 
        */
        if ( peekChWithoutTranslation() == ch2_b ){
            /* test succesful
             * move cursor to following writing position 
             */
            chForth();
            return EXIT_SUCCESS;
        }
        /* test NOT succesful
        ** output diagnostic and return FAILURE
        */
        cprintf("\n\rError on char: 0x%x. was 0x%x instead", ch, ch2_a);
    
        return EXIT_FAILURE;
    }
    cputc('.');
    cputc('.');
    return EXIT_SUCCESS;
}
开发者ID:MonteCarlos,项目名称:cc65,代码行数:52,代码来源:cpeekc.c

示例9: renderMenu

void renderMenu(uint8_t current) {
    uint8_t idx = 0;

    textcolor(1);
    revers(1);
    gotoxy(0, 0);
    for (idx = 0;  idx < menuSize;  idx++) {
        if (idx == current) {
            textcolor(3);
            cputs(menu[idx]);
            
            /*****************/
            cputsxy(0, 1, "\xf0\xc0\xc0\xc0\xc0\xee");
            gotoxy(0, 2);
            cprintf("\xdd%s\xdd", fileMenu[0]);
            gotoxy(0, 3);
            cprintf("\xdd%s\xdd", fileMenu[1]);
            gotoxy(0, 4);
            cprintf("\xdd%s\xdd", fileMenu[2]);
            gotoxy(0, 5);
            cprintf("\xdd%s\xdd", fileMenu[3]);
            cputsxy(0, 6, "\xed\xc0\xc0\xc0\xc0\xfd");
            /*****************/
            
        } else {
            cputs(menu[idx]);
        }
        textcolor(1);
        cputs("  ");
    }
    for (idx = wherex();  idx < 40;  idx++) {
        cputc(' ');
    }
}
开发者ID:afester,项目名称:CodeSamples,代码行数:34,代码来源:main.c

示例10: main

int main() {
    clrscr();
    bordercolor(0);
    bgcolor(6);

    renderMenu(100);

    textcolor(7);
    gotoxy(0, 1);
    updateStatus(' ');
    cursor(1);
    while(1) {
        char c;
/*
        uint8_t row;
        uint8_t col;
        for (row = 0;  row < 16;  row++) {
            gotoxy(0, row + 3);
            cprintf("%3d ", row * 16);
            for (col = 0;  col < 16;  col++) {
                cputc(row * 16 + col);
                cputc(' ');
            }
        }
*/
        c = cgetc();

        if (c == 20) {
            // backspace
        } else if (c == 13) {
            // Return
        } else if (c == 157) {
            // Left
            uint8_t xpos = wherex() - 1;
            gotox(xpos);
        } else if (c == 29) {
            // Right
            uint8_t xpos = wherex() + 1;
            gotox(xpos);
        } else if (c == 17) {
            // Down
            uint8_t ypos = wherey() + 1;
            gotoy(ypos);
        } else if (c == 145) {
            // Up
            uint8_t ypos = wherey() - 1;
            gotoy(ypos);
        } else if (c == 19) {
            // Pos1
        } else if (c == 3) {
            // ESC -> Menu
            processMenu();
        } else {
            cputc(c);
        }        

        
        updateStatus(c);
    }
}
开发者ID:afester,项目名称:CodeSamples,代码行数:60,代码来源:main.c

示例11: get_input_terminated_by

/*
 * get_input_terminated_by() reads input (handling backspace correctly) until
 * a terminator of |terminators| is encountered or |out| is full (outlen-1
 * characters were read).
 *
 * get_input_terminated_by() returns the terminator it encountered.
 *
 */
input_terminator_t get_input_terminated_by(input_terminator_mask_t terminators, char *out, BYTE outlen) {
	BYTE i = strlen(out);
	BYTE c, x, y;
	x = wherex() - i;
	y = wherey();
	while (1) {
		c = cgetc();
		if (((terminators & INPUT_TERMINATOR_RETURN) == INPUT_TERMINATOR_RETURN) && (c == PETSCII_CR)) {
			return INPUT_TERMINATOR_RETURN;
		} else if (((terminators & INPUT_TERMINATOR_SPACE) == INPUT_TERMINATOR_SPACE) && (c == PETSCII_SP)) {
			return INPUT_TERMINATOR_SPACE;
		} else if (c == PETSCII_DEL) {
			/* If you are at the left-most position, do nothing */
			if (i == 0)
				continue;
			out[--i] = '\0';
			cputcxy(x+i, y, ' ');
			gotoxy(x+i, y);
			continue;
		}
		if (i == (outlen-1)) {
			continue;
		}
		cputc(c);
		out[i++] = c;
	}
}
开发者ID:nnev,项目名称:c128-kasse,代码行数:35,代码来源:general.c

示例12: ctk_draw_menus

/*-----------------------------------------------------------------------------------*/
void
ctk_draw_menus(struct ctk_menus *menus)
{
  struct ctk_menu *m;

  /* Draw menus */
  (void)textcolor(MENUCOLOR);
  gotoxy(0, 0);
  revers(1);
  cputc(' ');
  for(m = menus->menus->next; m != NULL; m = m->next) {
    draw_menu(m, m == menus->open);
  }

  /* Draw desktopmenu */
  if(wherex() + strlen(menus->desktopmenu->title) + 1 >= sizex) {
    gotoxy(sizex - (unsigned char)strlen(menus->desktopmenu->title) - 1, 0);
  } else {
    cclear(sizex - wherex() -
	   (unsigned char)strlen(menus->desktopmenu->title) - 1);
  }
  draw_menu(menus->desktopmenu, menus->desktopmenu == menus->open);

  revers(0);
}
开发者ID:Inscribe,项目名称:msp430xf1611,代码行数:26,代码来源:ctk-conio.c

示例13: cputs

char *interactively_read_line(const char *prompt)
{
    const char DELETE = '\x7f';
    const char BACKSPACE = '\x08';
    bool line_is_complete = false;
    char c;
    size_t count = 0;

    cputs(prompt);

    while (! line_is_complete) {
        c = interactively_read_char();
        if (count > 0 && (c == DELETE || c == BACKSPACE)) {
            erase_backward(1);
            count--;
        }
        else if (c == '\r') {
            line[count] = '\0';
            line_is_complete = true;
        }
        else if (count < LINE_CAPACITY - 1) {
            cputc(c);
            line[count++] = c;
        }
        else {
            line[count] = '\0';
            line_is_complete = true;
        }
    }
    cputs("\r\n");
    return line;
}
开发者ID:gungwald,项目名称:posix-6502,代码行数:32,代码来源:more.c

示例14: draw_menu

void draw_menu(struct ctk_menu *m, struct ctk_menu *open) {
#if CC_CONF_UNSIGNED_CHAR_BUGS
  unsigned char x2;
  unsigned int x, y;
#else
  unsigned char x2;
  unsigned char x, y;
#endif
  x = cursx;
  cputs(m->title);
  cputc(CH_SPACE);

  if (m == open) {
    x2 = cursx;
    if(x + CTK_CONF_MENUWIDTH > SCREEN_WIDTH) {
      x = SCREEN_WIDTH - CTK_CONF_MENUWIDTH;
    }
  
    for(y = 0; y < m->nitems; y++) {
      if(y == m->active) {
	revers(0);
      }
      gotoxy(x, y + 1);
      if(m->items[y].title[0] == '-') {
	chline(CTK_CONF_MENUWIDTH);
      } else {
	cputs(m->items[y].title);
      }
      clearTo(x + CTK_CONF_MENUWIDTH);
      revers(1);
    }
    gotoxy(x2, 0);
  }
}
开发者ID:AlphaBetaPhi,项目名称:contiki,代码行数:34,代码来源:ctk-conio_arch-source.c

示例15: cputsn

/*---------------------------------------------------------------------------*/
void cputsn(char *str, unsigned char len) {
  while ((len > 0) && (*str != 0)) {
    cputc(*str);
    str++;
    len--;
  }
}
开发者ID:AlphaBetaPhi,项目名称:contiki,代码行数:8,代码来源:ctk-conio_arch-source.c


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