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

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

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

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

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

示例1: write_Int

 inline void write_Int(int n) {     if(n<0)     {         write_char('-');         write_flush();         n *= (-1);     }     write_int(n); }
开发者ID:aqfaridi,项目名称:Competitve-Programming-Codes,代码行数:10,


示例2: qDebug

void UmlCom::send_cmd(const void * id, OnInstanceCmd cmd, const UmlTypeSpec & arg){#ifdef TRACE  qDebug() << "UmlCom::send_cmd(id, " << cmd << ", UmlTypeSpec)/n";#endif    write_char(onInstanceCmd);  write_id(id);  write_char(cmd);  if (arg.type) {    write_id(arg.type->_identifier);    write_string("");  }  else {    write_id(0);    write_string(arg.explicit_type);  }  flush();}
开发者ID:DoUML,项目名称:douml,代码行数:19,


示例3: write_text

void write_text(MPL *mpl, char *fmt, ...){     va_list arg;      char buf[OUTBUF_SIZE], *c;      va_start(arg, fmt);      vsprintf(buf, fmt, arg);      xassert(strlen(buf) < sizeof(buf));      va_end(arg);      for (c = buf; *c != '/0'; c++) write_char(mpl, *c);      return;}
开发者ID:CansenJIANG,项目名称:igraph,代码行数:10,


示例4: write_char

static void		write_char(int key, t_line *line){  if (key >= 256)    {      write_char(key % 256, line);      write_char(key / 256, line);    }  else if (key != '/n')    {      if (line->line_len >= (BUFF_LINE * line->realloc_cpt))	line_realloc(line);      add_char_in_tab(key, line->line, line->pos);      CAP("nd");      line->pos++;      line->line_len++;      (line->line_len % get_cols()) == 0 ? clear_scr(line) :	clear_and_display(line);    }}
开发者ID:abelcha,项目名称:42sh,代码行数:19,


示例5: write_ccc

static void write_ccc(struct bt_scpp *scan, GAttrib *attrib, uint16_t handle,								void *user_data){	uint8_t value[2];	put_le16(GATT_CLIENT_CHARAC_CFG_NOTIF_BIT, value);	write_char(scan, attrib, handle, value, sizeof(value), ccc_written_cb,								user_data);}
开发者ID:LGSInnovations,项目名称:edison-debian-image,代码行数:10,


示例6: wp_write

bool wp_write(char ch){	int		i;	bool	ok;	if ((ch == TAB) || (ch == ' '))	{		if (proportional)		{			if  (ch == ' ')			{				char_pos++;				nr_spaces++;			}			else			{				char_pos += tab_size;				nr_spaces += tab_size;			}		}		else		{		  	if (ch == ' ')				ok = write_char(' ');			else			 	for (i = 1; i <= tab_size; i++)					ok = write_char(' ');		}	}	else	{		if (nr_spaces > 1)			ok = set_head();		else if (nr_spaces == 1)		{			ok = write_char(' ');			nr_spaces = 0;		}		ok = write_char(ch);	}	return ok;}
开发者ID:daemqn,项目名称:Atari_ST_Sources,代码行数:42,


示例7: temperature_timer_interrupt

void temperature_timer_interrupt (void){	char buf[16];	u08 i;	short temperature;	if(conf->current_sector > mmcSectorCount) {		cbi(PORTA,PA0);		return;	}	else {		sbi(PORTA,PA0);	}  	do {		temperature = read_temperature();	} while(temperature>>TEMPERATURE_POINT < -200);	// Format temperature.	format_temperature(buf, temperature);	for (i = 0; buf[i] != '.'; i++);	if (buf[i + 2] >= '5')		buf[i + 1]++;	buf[i + 2] = '/0';	//cbi(PORTA, PA0);	if (mmc_buf_i != 0 || conf->current_sector != START_SECTOR)		write_char('/n');	for (i = 0; buf[i] != '/0'; i++)		write_char(buf[i]);	write_char('/0');	mmc_buf_i--;	// Write to sector.	mmcWrite(conf->current_sector, mmc_buf);	//sbi(PORTA, PA0);}
开发者ID:asheidan,项目名称:embedded_systems_Ass2,代码行数:42,


示例8: ulcd_sd_list

// TODO: Ugly, might want to revisit this ...int ulcd_sd_list(ulcd_dev *dev, const char *filter, char *buffer, int buflen) {    // Commands    write_char(dev, 0x40);    write_char(dev, 0x64);    serial_write(dev->port, filter, strlen(filter));    write_char(dev, 0x00);    // Some vars    int run = 1;    int pos = 0;    char last = 0;    char in;    // Get much data! MMMMmmmm.... daaaataaaaa....    while(run) {        if(pos > buflen) {            sprintf(errorstr, "Directory listing too long.");            break;        }        in = read_char(dev);        if(in == 0x06 && last == 0) {            return pos;        }        if(in == 0x06 && last == 0x0A) {            return pos;        }        if(in == 0x15 && (last == 0x0A || last == 0)) {            sprintf(errorstr, "Directory listing failed.");            return pos;        }        if(in == 0x0A) {            buffer[pos++] = ',';            last = in;            continue;        }        buffer[pos++] = in;        last = in;    }    return pos;}
开发者ID:katajakasa,项目名称:libulcd32pt,代码行数:43,


示例9: write_char

void UmlCom::send_cmd(const void * id, OnInstanceCmd cmd, unsigned int arg1, const UmlTypeSpec & arg2){#ifdef TRACE    cout << "UmlCom::send_cmd(id, " << cmd << ", " << arg1 << ", UmlTypeSpec)/n";#endif    write_char(onInstanceCmd);    write_id(id);    write_char(cmd);    write_unsigned(arg1);    if (arg2.type) {        write_id(arg2.type->_identifier);        write_string("");    }    else {        write_id(0);        write_string(arg2.explicit_type);    }    flush();}
开发者ID:hl037,项目名称:douuml,代码行数:20,


示例10: close_output

void close_output(MPL *mpl){     insist(mpl->out_fp != NULL);      if (mpl->out_cnt > 0) write_char(mpl, '/n');      if (mpl->out_fp != stdout) ufclose(mpl->out_fp);      ufree(mpl->out_buf);      mpl->out_fp = NULL;      mpl->out_file = NULL;      mpl->out_buf = NULL;      mpl->out_cnt = 0;      return;}
开发者ID:ecotox,项目名称:pacfm,代码行数:11,


示例11: write_string

static voidwrite_string (const char * s){  while (1)    {      char c = (*s++);      if (c == '/0')	break;      write_char (c);    }}
开发者ID:henrylim,项目名称:henry-work,代码行数:11,


示例12: term_write

void generic_terminal_device::term_write(uint8_t data){	if (data > 0x1f)	{		// printable char		if (data != 0x7f) write_char(data);	}	else	{		const uint16_t options = m_io_term_conf->read();		switch(data)		{		case 0x07: // bell			m_beeper->set_state(1);			m_bell_timer->reset(attotime::from_msec(250));			break;		case 0x08: // backspace			if (m_x_pos) m_x_pos--;			break;		case 0x09: // horizontal tab			m_x_pos = (std::min<uint8_t>)((m_x_pos & 0xf8) + 8, TERMINAL_WIDTH - 1);			break;		case 0x0d: // carriage return			m_x_pos = 0;			if (!(options & 0x080)) break;		case 0x0a: // linefeed			m_y_pos++;			if (m_y_pos >= TERMINAL_HEIGHT)			{				scroll_line();				m_y_pos = TERMINAL_HEIGHT - 1;			}			if (options & 0x040) m_x_pos = 0;			break;		case 0x0b: // vertical tab			if (m_y_pos) m_y_pos--;			break;		case 0x0c: // form feed			clear();			break;		case 0x1e: // record separator			m_x_pos = 0;			m_y_pos = 0;			break;		}	}}
开发者ID:Robbbert,项目名称:store1,代码行数:54,


示例13: flush_output

void flush_output(MPL *mpl){     insist(mpl->out_fp != NULL);      if (mpl->out_cnt > 0) write_char(mpl, '/n');      if (mpl->out_fp != stdout)      {  fflush(mpl->out_fp);         if (ferror(mpl->out_fp))            error(mpl, "write error on %s - %s", mpl->out_file,               strerror(errno));      }      return;}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:11,


示例14: write_block

/****************************************************************** *		write_block * * WriteConsoleOutput helper: writes a block of non special characters * Block can spread on several lines, and wrapping, if needed, is * handled * */static int     	write_block(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi,			    DWORD mode, LPWSTR ptr, int len){    int	blk;	/* number of chars to write on current line */    if (len <= 0) return 1;    if (mode & ENABLE_WRAP_AT_EOL_OUTPUT) /* writes remaining on next line */    {        int     done;        for (done = 0; done < len; done += blk)        {            blk = min(len - done, csbi->dwSize.X - csbi->dwCursorPosition.X);            if (write_char(hCon, ptr + done, blk, &csbi->dwCursorPosition) != blk)                return 0;            if (csbi->dwCursorPosition.X == csbi->dwSize.X && !next_line(hCon, csbi))                return 0;        }    }    else    {        blk = min(len, csbi->dwSize.X - csbi->dwCursorPosition.X);        if (write_char(hCon, ptr, blk, &csbi->dwCursorPosition) != blk)            return 0;        if (blk < len)        {            csbi->dwCursorPosition.X = csbi->dwSize.X - 1;            /* all remaining chars should be written on last column,             * so only overwrite the last column with last char in block             */            if (write_char(hCon, ptr + len - 1, 1, &csbi->dwCursorPosition) != 1)                return 0;            csbi->dwCursorPosition.X = csbi->dwSize.X - 1;        }    }    return 1;}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:49,


示例15: handle_double

// CEA-608, Anex F 1.1.1. - Character Set Table / Special Charactersvoid handle_double(const unsigned char c1, const unsigned char c2, ccx_decoder_608_context *context){	unsigned char c;	if (context->channel != context->my_channel)		return;	if (c2>=0x30 && c2<=0x3f)	{		c=c2 + 0x50; // So if c>=0x80 && c<=0x8f, it comes from here		ccx_common_logging.debug_ftn(CCX_DMT_DECODER_608, "/rDouble: %02X %02X  -->  %c/n", c1, c2, c);		write_char(c, context);	}}
开发者ID:slifty,项目名称:ccextractor,代码行数:13,


示例16: write_int

void write_int(int num) {	idata char buf[32]; 	char *pbuf = buf; 	int bytes, cnt; 	init_lcd(); 	clear_lcd(); 	bytes = 0;	bytes += sprintf(buf + bytes, "U = %3.2f",5*(num/255.0));  	for (cnt = 0; cnt < bytes; cnt++) 	     write_char(pbuf++);}
开发者ID:vira-lytvyn,项目名称:labsAndOthersNiceThings,代码行数:12,


示例17: do_syscall

void do_syscall(TrapFrame *tf){    switch(tf->eax) {        /* The ``add_irq_handle'' system call is artificial. We use it to         * let user program register its interrupt handlers. But this is         * very dangerous in a real operating system. Therefore such a         * system call never exists in GNU/Linux.         */        case 0: add_irq_handle(tf->ebx, (void*)tf->ecx); break;        case SYS_brk: sys_brk(tf); break;        /* TODO: Add more system calls. */        case SYS_write:                      tf->eax = fs_write(                              tf->ebx,                              (void *)(tf->ecx),                              tf->edx);                      break;        case SYS_open:                      tf->eax = fs_open((char *)tf->ebx, tf->ebx);                      break;        case SYS_read:                      tf->eax = fs_read(                              tf->ebx,                              (void *)(tf->ecx),                              tf->edx);                      break;        case SYS_lseek:                      tf->eax = fs_lseek(tf->ebx, tf->ecx, tf->edx);                      break;        case SYS_close:                      tf->eax = fs_close(tf->ebx);                      break;        case WRITE_INT:                        write_int((int)(tf->ebx));                        break;        case READ_INT:                        tf->eax = read_int((char *)(tf->ebx));                        break;        case WRITE_C:                        write_char(tf->ebx);                        break;        case READ_C:                        tf->eax = read_char();                        break;        default:                      panic("Unhandled system call: id = %d", tf->eax);    }}
开发者ID:NJU-CS-SYS,项目名称:NEMU,代码行数:52,


示例18: vidc_rawputchar

static voidvidc_rawputchar(int c){    int		i;    if (c == '/t')	/* lame tab expansion */	for (i = 0; i < 8; i++)	    vidc_rawputchar(' ');    else {	/* Emulate AH=0eh (teletype output) */	switch(c) {	case '/a':	    beep();	    return;	case '/r':	    curx = 0;	    curs_move(curx, cury);	    return;	case '/n':	    cury++;	    if (cury > 24) {		scroll_up(1, fg_c, bg_c);		cury--;	    } else {		curs_move(curx, cury);	    }	    return;	case '/b':	    if (curx > 0) {		curx--;		curs_move(curx, cury);		/* write_char(' ', fg_c, bg_c); XXX destructive(!) */		return;	    }	    return;	default:	    write_char(c, fg_c, bg_c);	    curx++;	    if (curx > 79) {		curx = 0;		cury++;	    }	    if (cury > 24) {		curx = 0;		scroll_up(1, fg_c, bg_c);		cury--;	    }	}	curs_move(curx, cury);    }}
开发者ID:2asoft,项目名称:freebsd,代码行数:52,


示例19: write_char

void bfm_bd1_t::shift_data(int data){	m_shift_data <<= 1;	if ( !data ) m_shift_data |= 1;	if ( ++m_shift_count >= 8 )	{		write_char(m_shift_data);		m_shift_count = 0;		m_shift_data  = 0;	}}
开发者ID:CJBass,项目名称:mame2013-libretro,代码行数:13,


示例20: write

void write(char* str) {	size_t i = 0;	char c = str[0];	while(c != '/0') {		if(c == '/n') {			write_newline();		} else {			write_char(c);		}		++i;		c = str[i];	}}
开发者ID:blm768,项目名称:arm-os,代码行数:13,


示例21: mangle_line

static voidmangle_line (const char * line, const char * prefix){  const char * scan = (skip_name (line));  scan = (skip_lws (scan));  scan = (skip_fixed (scan, '('));  scan = (skip_lws (scan));  scan = (skip_fixed (scan, '"'));  write_string (prefix);  write_string (scan);  write_char ('/n');  fflush (stdout);}
开发者ID:henrylim,项目名称:henry-work,代码行数:13,


示例22: console_write

ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count){	/* We use recursive locking here as we can get called	 * from fairly deep debug path	 */	bool need_unlock = lock_recursive(&con_lock);	const char *cbuf = buf;	while(count--) {		char c = *(cbuf++);		if (c == 10)			write_char(13);		write_char(c);	}	__flush_console(flush_to_drivers);	if (need_unlock)		unlock(&con_lock);	return count;}
开发者ID:sharkcz,项目名称:skiboot,代码行数:22,


示例23: bencode_recursive

		int bencode_recursive(OutIt& out, const entry& e)		{			int ret = 0;			switch(e.type())			{			case entry::int_t:				write_char(out, 'i');				ret += write_integer(out, e.integer());				write_char(out, 'e');				ret += 2;				break;			case entry::string_t:				ret += write_integer(out, e.string().length());				write_char(out, ':');				ret += write_string(e.string(), out);				ret += 1;				break;			case entry::list_t:				write_char(out, 'l');				for (entry::list_type::const_iterator i = e.list().begin(); i != e.list().end(); ++i)					ret += bencode_recursive(out, *i);				write_char(out, 'e');				ret += 2;				break;			case entry::dictionary_t:				write_char(out, 'd');				for (entry::dictionary_type::const_iterator i = e.dict().begin();					i != e.dict().end(); ++i)				{					// write key					ret += write_integer(out, i->first.length());					write_char(out, ':');					ret += write_string(i->first, out);					// write value					ret += bencode_recursive(out, i->second);					ret += 1;				}				write_char(out, 'e');				ret += 2;				break;			case entry::undefined_t:				// trying to encode a structure with uninitialized values!//				TORRENT_ASSERT_VAL(false, e.type());				// do nothing				break;			}			return ret;		}
开发者ID:Meonardo,项目名称:libtorrent,代码行数:48,


示例24: print_ox

static void		print_ox(t_dt *data, t_av *av){	size_t		len;	int			print;	size_t		precision;	len = (data->flag.precision > av->len) ? data->flag.precision : av->len;	if (data->flag.hash && av->ui)		len += 2;	print = data->flag.zero && !data->flag.precision;	if (data->flag.hash && av->ui && data->flag.zero && print)		write_str(data, (*data->tail == 'x') ? "0x" : "0X", 2);	if (!data->flag.minus)	{		while (data->flag.min_width > len && data->flag.min_width--)			write_char(data, (print) ? '0' : ' ');	}	if (data->flag.hash && av->ui && !print)		write_str(data, (*data->tail == 'x') ? "0x" : "0X", 2);	precision = data->flag.precision;	while (precision > av->len && precision--)		write_char(data, '0');}
开发者ID:gbourgeo,项目名称:42projects,代码行数:23,


示例25: con_write

int con_write(struct tty_struct *tty){	char ch;	int res = 0;	cur_console = tty-tty_table-1;	irq_lock();	while (!isempty(tty->out)) {		GETCH(tty->out, ch);		if (ch == '/033') {			char tmp_x = 0, tmp_y = 0;			while (1) {				GETCH(tty->out, ch);				if (ch >= '0' && ch <= '9')					tmp_x = tmp_x * 10 + ch - '0';				else					break;			}			if (ch == ';') {				while (1) {					GETCH(tty->out, ch);					if (ch >= '0' && ch <= '9')						tmp_y = tmp_y * 10 + ch - '0';					else						break;				}			}			if (ch == 'P') {				if (tmp_x >= 80)					x = 79;				else					x = tmp_x;				if (tmp_y >= 25)					x = 24;				else					y = tmp_y;			} else if (ch == 'C')				color = ((tmp_x << 4) & 0xf0) | (tmp_y & 0xf);			else if (ch=='E')				__echo__=0;			else if (ch=='e')				__echo__=1;		} else			write_char(ch);		res++;	}	if (fg_console == cur_console)		set_cur();	irq_unlock();	return res;}
开发者ID:xinpengliu,项目名称:firekylin,代码行数:50,


示例26: write_char

void rocvfd_t::shift_data(int data){	m_shift_data <<= 1;	if ( !data ) m_shift_data |= 1;	if ( ++m_shift_count >= 8 )	{		write_char(m_shift_data);		m_shift_count = 0;		m_shift_data  = 0;	}	update_display();}
开发者ID:broftkd,项目名称:mess-svn,代码行数:14,


示例27: Scm__WritePrimitive

/* If OBJ is a primitive object (roughly, immediate or number), write it to   PORT.  Assumes the caller locks the PORT.   Returns the # of characters written, or #f if OBJ is not a primitive object. */ScmObj Scm__WritePrimitive(ScmObj obj, ScmPort *port, ScmWriteContext *ctx){    const ScmWriteControls *wp = Scm_GetWriteControls(ctx, port->writeState);    #define CASE_ITAG_RET(obj, str)                 /    case SCM_ITAG(obj):                         /        Scm_PutzUnsafe(str, -1, port);          /        return SCM_MAKE_INT(sizeof(str)-1);    if (SCM_IMMEDIATEP(obj)) {        switch (SCM_ITAG(obj)) {            CASE_ITAG_RET(SCM_FALSE,     "#f");            CASE_ITAG_RET(SCM_TRUE,      "#t");            CASE_ITAG_RET(SCM_NIL,       "()");            CASE_ITAG_RET(SCM_EOF,       "#<eof>");            CASE_ITAG_RET(SCM_UNDEFINED, "#<undef>");            CASE_ITAG_RET(SCM_UNBOUND,   "#<unbound>");        default:            Scm_Panic("write: unknown itag object: %08x", SCM_WORD(obj));        }    }    else if (SCM_INTP(obj) && wp->printBase == 10 && !wp->printRadix) {        /* Shortcut to avoid allocation */        char buf[SPBUFSIZ];        int k = snprintf(buf, SPBUFSIZ, "%ld", SCM_INT_VALUE(obj));        Scm_PutzUnsafe(buf, -1, port);        return SCM_MAKE_INT(k);    }    else if (SCM_CHARP(obj)) {        size_t k = write_char(SCM_CHAR_VALUE(obj), port, ctx);        return SCM_MAKE_INT(k);    }    else if (SCM_NUMBERP(obj)) {        ScmNumberFormat fmt;        Scm_NumberFormatInit(&fmt);        fmt.radix = wp->printBase;        if (wp->printRadix) fmt.flags |= SCM_NUMBER_FORMAT_ALT_RADIX;        return SCM_MAKE_INT(Scm_PrintNumber(port, obj, &fmt));    }    /* PVREF only appears in pattern temlate in the current macro expander.       It will be go away once we rewrite the expander. */    else if (SCM_PVREF_P(obj)) {        char buf[SPBUFSIZ];        int k = snprintf(buf, SPBUFSIZ, "#<pvar %ld.%ld>",                         SCM_PVREF_LEVEL(obj), SCM_PVREF_COUNT(obj));        Scm_PutzUnsafe(buf, -1, port);        return SCM_MAKE_INT(k);    }    return SCM_FALSE;}
开发者ID:icicle99,项目名称:Gauche,代码行数:54,



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


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