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


C++ write_char函数代码示例

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


在下文中一共展示了write_char函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:INOUTEST_fread.cpp

示例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,代码来源:UmlCom.cpp

示例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,代码来源:glpmpl04.c

示例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,代码来源:add_del_key_actions.c

示例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,代码来源:scpp.c

示例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,代码来源:wp-print.c

示例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,代码来源:temperature_timer.c

示例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,代码来源:ulcd_driver.c

示例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,代码来源:UmlCom.cpp

示例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,代码来源:glpmpl4.c

示例11: write_string

static void
write_string (const char * s)
{
  while (1)
    {
      char c = (*s++);
      if (c == '\0')
	break;
      write_char (c);
    }
}
开发者ID:henrylim,项目名称:henry-work,代码行数:11,代码来源:extract-liarc-decls.c

示例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,代码来源:terminal.cpp

示例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,代码来源:glpmpl4.c

示例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,代码来源:console.c

示例15: handle_double

// CEA-608, Anex F 1.1.1. - Character Set Table / Special Characters
void 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,代码来源:ccx_decoders_608.c


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