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


C++ write_str函数代码示例

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


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

示例1: pf_o

void		pf_o(t_dt *data)
{
	t_av	av;
	int		len;

	av.ui = get_modifier(data);
	av.s = ft_itoa_base(av.ui, 8);
	av.len = ft_strlen(av.s) + data->flag.hash;
	len = (data->flag.precision > av.len) ? data->flag.precision : av.len;
	print_zero_space(data, &av);
	if (*data->tail == 'o')
	{
		if (data->flag.hash || !data->flag.point || av.ui)
			write_str(data, av.s, av.len - data->flag.hash);
	}
	else if (!data->flag.point || *(data->flag.point + 1) != '0')
		write_str(data, av.s, av.len - data->flag.hash);
	if (data->flag.minus)
	{
		while (data->flag.min_width > len && data->flag.min_width--)
			write_char(data, ' ');
	}
	if (av.s)
		free(av.s);
}
开发者ID:gbourgeo,项目名称:42projects,代码行数:25,代码来源:pf_o.c

示例2: nRF24L01_RxPacket

uchar nRF24L01_RxPacket(uchar *rx_buf)
{	 
    uchar revale=0;
	SPI_Write_Buf(WRITE_REG + RX_ADDR_P0,RX_ADDRESS, RX_ADR_WIDTH);
	CE=0;
	SPI_RW_Reg(WRITE_REG + CONFIG, 0x0f);   		// IRQ收发完成中断响应,16位CRC	,主接收
	CE = 1; 
	inerDelay_us(130);
	sta=SPI_Read(STATUS);     // 读取状态寄存其来判断数据接收状况
	if(RX_DR)				// 判断是否接收到数据
	{
	    CE = 0; 			//SPI使能
		SPI_Read_Buf(RD_RX_PLOAD,rx_buf,RX_PLOAD_WIDTH);// read receive payload from RX_FIFO buffer
		revale =1;			//读取数据完成标志
						write_com(0x80);
						write_str("   Hum");
						write_data(':');
						write_data(rx_buf[1]/10%10+48);
						write_data(rx_buf[1]%10+48);
						
						write_data('%');
						write_com(0x80+0x40);
						write_str("   Tem");
						write_data(':');
						write_data(rx_buf[2]/10%10+48);
						write_data(rx_buf[2]%10+48);
                        write_data(0xdf);
						write_data('c');
				
	}
	SPI_RW_Reg(WRITE_REG+STATUS,sta);   //接收到数据后RX_DR,TX_DS,MAX_PT都置高为1,通过写1来清楚中断标志
	return revale;
}
开发者ID:18959263172,项目名称:hardware,代码行数:33,代码来源:shou.c

示例3: pars_beep

void pars_beep(void) {
    switch (pars_number()) {
        case MSG_BEEPBEEP:
            if (strncmp(config->nick, packet, NICK_MAXLEN)) break;
            strncpy(status->nick, pars_word(), NICK_MAXLEN);
            if (user_ignore()) break;
            snprintf(message, MSG_SIZE, PARS_BEEP, time_get(), status->nick);
            if (config->verbose) {
                write_log(config->log_main);
                write_str(status->room->name, COL_MESG);
            }
            if ((config->mode == MOD_NORMAL) || (config->mode == MOD_DND) ||
                    ((config->mode == MOD_AWAY) && user_favorite())) {
                make_beepack();
                beep_beep();
            }
            break;
        case MSG_BEEPACK:
            if (strncmp(config->nick, packet, NICK_MAXLEN)) break;
            if (!config->packet_qchat) {
                strncpy(status->nick, pars_word(), NICK_MAXLEN); 
                status->gender = pars_number();
            }
            snprintf(message, MSG_SIZE, PARS_BEEPACK, time_get(), status->nick);
            write_log(config->log_main);
            write_str(status->room->name, COL_MESG);
            break;
        default:
#ifdef  DEBUG
            fprintf(debug_file, "error: Unknown beep type.\n");
            fflush(debug_file);
#endif  /* DEBUG */
            break;
    }
}
开发者ID:Mermouy,项目名称:archlinux-stuff,代码行数:35,代码来源:pckt_pars.c

示例4: write_errnos_in

/* Write system errnos to stdout.  The function is allowed to
   modify LINE.  Trailing white space is already removed.  Passing
   NULL resets the internal state.  */
static void
write_errnos_in (char *line)
{
  static int state;
  char *p1, *p2;

  if (!line)
    {
      state = 0;
      return;
    }

  if (!*line)
    return;

  if (!state && strchr ("0123456789", *line))
    state = 1;
  else if (state == 1 && !strchr ("0123456789", *line))
    state = 2;

  if (state != 1)
    return;

  p1 = strtok (line, " \t");
  p2 = p1? strtok (NULL, " \t") : NULL;

  if (p1 && p2 && strchr ("0123456789", *p1) && *p2)
    {
      write_str ("    GPG_ERR_");
      write_str (p2);
      write_str (" = GPG_ERR_SYSTEM_ERROR | ");
      write_str (p1);
      write_str (",\n");
    }
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:38,代码来源:mkheader.c

示例5: write_sources_or_codes

/* Write SOURCE or CODES line to stdout.  The function is allowed to
   modify LINE.  Trailing white space is already removed.  Passing
   NULL resets the internal state.  */
static void
write_sources_or_codes (char *line)
{
  static int in_intro;
  char *p1, *p2;

  if (!line)
    {
      in_intro = 1;
      return;
    }

  if (!*line)
    return;

  if (in_intro)
    {
      if (!strchr ("0123456789", *line))
        return;
      in_intro = 0;
    }

  p1 = strtok (line, " \t");
  p2 = p1? strtok (NULL, " \t") : NULL;

  if (p1 && p2 && strchr ("0123456789", *p1) && *p2)
    {
      write_str ("    ");
      write_str (p2);
      write_str (" = ");
      write_str (p1);
      write_str (",\n");
    }
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:37,代码来源:mkheader.c

示例6: main

/**
 * 主函数,显示一些东西
 * @return
 */
int main(void)
{
    uint8_t ch;
    //0. 初始化LCD
    init_lcd();
    //1. 最简单的字符输出测试 (写数据)
    set_pos(0x00);
    write_str("hello world");
    _delay_ms(100);
    //2. 读取数据测试 (读数据)
    _delay_ms(100);
    set_pos(0x06);     //设置读取的位置,第1行6列,'w'的位置
    _delay_ms(1000);
    ch = get_data();
    set_pos(0x0D);     //设置光标位置
    set_data(ch);
    _delay_ms(1000);
    //3. 自定义字符测试 (写内存+读内存)
    init_chardb();     //初始化自定义的字符集
    set_pos(0x40);     //设置在第2行还是显示
    int i;
    for ( i =0; i<0b111+1; i++) {
        set_data(i);
        //_delay_ms(50);
    }
    //4. 读取光标位置 (读地址/位置) I处即光标所在地址
    _delay_ms(1000);
    char str[5];
    set_pos(0x4a);
    ch=get_pos();
    sprintf(str,"I=%02XH",ch);
    write_str(str);
    return 0;
}
开发者ID:zodiac1111,项目名称:lcd_4bit_allport,代码行数:38,代码来源:main.c

示例7: pars_chat

void pars_chat(void) {
    strncpy(status->channel, packet, CHANNEL_MAXLEN);
    strncpy(status->nick, pars_word(), NICK_MAXLEN);
    if (user_ignore()) return;
    if (strncmp(status->chnl[0].name, status->channel, CHANNEL_MAXLEN) &&
        !chnl_getnum()) return;
    snprintf(message, MSG_SIZE, "[%s] <%s> %s\n", time_get(), status->nick, pars_word());
#ifdef  TCP
    write_tcp(status->channel);
#endif  /* TCP */
    write_log(config->log_main);

/* SERGEJ */
if(g_show_channel)
{
    if (!strncmp(config->nick, status->nick, NICK_MAXLEN))
        write_str(status->channel, COL_MY);
    else
        write_str(status->channel, COL_CHAT);
}
/* SERGEJ */

    if ((!config->my_only || !strncmp(status->room->name, status->channel, CHANNEL_MAXLEN)) &&
        (config->mode == MOD_NORMAL)) beep_chat();
}
开发者ID:Mermouy,项目名称:archlinux-stuff,代码行数:25,代码来源:pckt_pars.c

示例8: set_ddram_address

void ST7920_Lite_Status_Screen::draw_status_message() {
  const char *str = ui.status_message;

  set_ddram_address(DDRAM_LINE_4);
  begin_data();
  #if ENABLED(STATUS_MESSAGE_SCROLLING)

    uint8_t slen = utf8_strlen(str);

    if (slen <= LCD_WIDTH) {
      // String fits the LCD, so just print it
      write_str(str);
      for (; slen < LCD_WIDTH; ++slen) write_byte(' ');
    }
    else {
      // String is larger than the available space in screen.

      // Get a pointer to the next valid UTF8 character
      const char *stat = str + ui.status_scroll_offset;

      // Get the string remaining length
      const uint8_t rlen = utf8_strlen(stat);

      // If we have enough characters to display
      if (rlen >= LCD_WIDTH) {
        // The remaining string fills the screen - Print it
        write_str(stat, LCD_WIDTH);
      }
      else {
        // The remaining string does not completely fill the screen
        write_str(stat);                        // The string leaves space
        uint8_t chars = LCD_WIDTH - rlen;         // Amount of space left in characters

        write_byte('.');                        // Always at 1+ spaces left, draw a dot
        if (--chars) {                          // Draw a second dot if there's space
          write_byte('.');
          if (--chars)
            write_str(str, chars);              // Print a second copy of the message
        }
      }

      // Adjust by complete UTF8 characters
      if (ui.status_scroll_offset < slen) {
        ui.status_scroll_offset++;
        while (!START_OF_UTF8_CHAR(str[ui.status_scroll_offset]))
          ui.status_scroll_offset++;
      }
      else
        ui.status_scroll_offset = 0;
    }

  #else

    uint8_t slen = utf8_strlen(str);
    write_str(str, LCD_WIDTH);
    for (; slen < LCD_WIDTH; ++slen) write_byte(' ');

  #endif
}
开发者ID:teemuatlut,项目名称:Marlin,代码行数:59,代码来源:status_screen_lite_ST7920.cpp

示例9: launch_not_found

int	launch_not_found(t_cmd *cmd)
{
  write_str(g_fstdout, "Error: command ");
  write_str(g_fstdout, cmd->cmd);
  write_str(g_fstdout, " not found.\n");
  flush_file(g_fstdout);
  return (SIGRTN_NOTFND);
}
开发者ID:Sorikairo,项目名称:42sh,代码行数:8,代码来源:launch.c

示例10: add_extra_suffixes

/*
 * Add the arcitecture suffix to the program name if needed,
 * except on Windows, where we insert it just before ".DLL".
 */
static char*
add_extra_suffixes(char *prog, int type)
{
   char *res;
   char *p;
   int len;
#ifdef __WIN32__
   char *dll_p;
   int dll = 0;
#endif

   if (!type) {
       return prog;
   }

   len = strlen(prog);

   /* Worst-case allocation */
   p = emalloc(len +
	       EMU_TYPE_SUFFIX_LENGTH +
	       + 1);
   res = p;
   p = write_str(p, prog);

#ifdef __WIN32__
   dll_p = res + len - 4;
   if (dll_p >= res) {
      if (dll_p[0] == '.' &&
	  (dll_p[1] == 'd' || dll_p[1] == 'D') &&
	  (dll_p[2] == 'l' || dll_p[2] == 'L') &&
	  (dll_p[3] == 'l' || dll_p[3] == 'L')) {
	  p = dll_p;
	  dll = 1;
      }
   }
#endif

#ifdef __WIN32__
   if (type & EMU_TYPE_DEBUG) {
       p = write_str(p, DEBUG_SUFFIX);
       type &= ~(EMU_TYPE_DEBUG);
   }
#endif
   if (type == EMU_TYPE_SMP) {
       p = write_str(p, SMP_SUFFIX);
   }
   else if (type == EMU_TYPE_HYBRID) {
       p = write_str(p, HYBRID_SUFFIX);
   }
#ifdef __WIN32__
   if (dll) {
       p = write_str(p, DLL_EXT);
   }
#endif

   return res;
}
开发者ID:AugustoFernandes,项目名称:otp,代码行数:61,代码来源:erlexec.c

示例11: pars_execack

void pars_execack(void) {
    if (strncmp(config->nick, packet, NICK_MAXLEN)) return;
    strncpy(status->nick, pars_word(), NICK_MAXLEN);
    snprintf(message, MSG_SIZE, PARS_EXECACK, time_get(), status->nick);
    write_log(config->log_main);
    write_str(status->chnl[0].name, COL_SYSTEM);
    snprintf(message, MSG_SIZE, "%s\n", pars_word());
    write_log(config->log_main);
    write_str(status->chnl[0].name, COL_SYSTEM);
}
开发者ID:Mermouy,项目名称:archlinux-stuff,代码行数:10,代码来源:pckt_pars.c

示例12: save_font_list

void save_font_list(void)
{
	char *file_name = obs_module_config_path("font_data.bin");
	uint32_t font_checksum = get_font_checksum();
	int font_count = (int)font_list.num;
	struct serializer s;
	bool success = false;

	if (font_checksum)
		success = file_output_serializer_init_safe(&s, file_name,
				"tmp");
	bfree(file_name);

	if (!success)
		return;

	success = write_var(&s, font_cache_ver);
	if (!success) return;
	success = write_var(&s, font_checksum);
	if (!success) return;
	success = write_var(&s, font_count);
	if (!success) return;

#define do_write(var) \
	success = write_var(&s, var); \
	if (!success) break

	for (size_t i = 0; i < font_list.num; i++) {
		struct font_path_info *info = &font_list.array[i];

		success = write_str(&s, info->face_and_style);
		if (!success) break;

		do_write(info->full_len);
		do_write(info->face_len);
		do_write(info->is_bitmap);
		do_write(info->num_sizes);

		success = write_data(&s, info->sizes,
				sizeof(int) * info->num_sizes);
		if (!success) break;

		do_write(info->bold);

		success = write_str(&s, info->path);
		if (!success) break;

		do_write(info->italic);
		do_write(info->index);
	}

#undef do_write

	file_output_serializer_free(&s);
}
开发者ID:AhmedAbdulSalam5,项目名称:obs-studio,代码行数:55,代码来源:find-font.c

示例13: core_info_read

static ssize_t core_info_read(struct file *file, char __user *buf,
		size_t count, loff_t *ppos)
{
	struct msm_vidc_core *core = file->private_data;
	int i = 0;
	if (!core) {
		dprintk(VIDC_ERR, "Invalid params, core: %p\n", core);
		return 0;
	}
	INIT_DBG_BUF(dbg_buf);
	write_str(&dbg_buf, "===============================\n");
	write_str(&dbg_buf, "CORE %d: 0x%p\n", core->id, core);
	write_str(&dbg_buf, "===============================\n");
	write_str(&dbg_buf, "state: %d\n", core->state);
	write_str(&dbg_buf, "base addr: 0x%x\n", core->base_addr);
	write_str(&dbg_buf, "register_base: 0x%x\n", core->register_base);
	write_str(&dbg_buf, "register_size: %u\n", core->register_size);
	write_str(&dbg_buf, "irq: %u\n", core->irq);
	for (i = SYS_MSG_START; i < SYS_MSG_END; i++) {
		write_str(&dbg_buf, "completions[%d]: %s\n", i,
			completion_done(&core->completions[SYS_MSG_INDEX(i)]) ?
			"pending" : "done");
	}
	return simple_read_from_buffer(buf, count, ppos,
			dbg_buf.ptr, dbg_buf.filled_size);
}
开发者ID:ChangYeoun,项目名称:10.1,代码行数:26,代码来源:msm_vidc_debug.c

示例14: pars_exec

void pars_exec(void) {
    strncpy(status->nick, packet, NICK_MAXLEN);
    if (user_ignore()) return;
    if (strncmp(config->nick, pars_word(), NICK_MAXLEN)) return;
    snprintf(message, MSG_SIZE, PARS_EXEC, time_get(), status->nick);
    write_log(config->log_main);
    write_str(status->room->name, COL_ERROR);
    snprintf(message, MSG_SIZE, "%s\n", pars_word());
    write_log(config->log_main);
    write_str(status->room->name, COL_ERROR);
    if (config->mode != MOD_OFF) make_execack();
}
开发者ID:Mermouy,项目名称:archlinux-stuff,代码行数:12,代码来源:pckt_pars.c

示例15: pars_newtopic

void pars_newtopic(void) {
    if (config->packet_qchat) {
        strncpy(status->chnl[0].topic, packet, STR_SIZE);
        snprintf(message, MSG_SIZE, PARS_QTOPIC, time_get());
#ifdef  TCP
        write_tcp(status->room->name);
#endif  /* TCP */
        if (config->verbose) {
            write_log(config->log_main);
            write_str(status->room->name, COL_SYSTEM);
        }
/* SERGEJ */        validate_string(status->chnl[0].topic);
        snprintf(message, MSG_SIZE, "%s\n", status->chnl[0].topic);
#ifdef  TCP
        write_tcp(status->room->name);
#endif  /* TCP */
        if (config->verbose) {
            write_log(config->log_main);
            write_str(status->room->name, COL_SYSTEM);
        }
    } else {
        strncpy(status->channel, packet, CHANNEL_MAXLEN);
        if (strncmp(status->chnl[0].name, status->channel, CHANNEL_MAXLEN) &&
            !chnl_getnum()) return;
        strncpy(status->chnl[chnl_getnum()].topic, pars_word(), STR_SIZE);
        snprintf(message, MSG_SIZE, PARS_TOPIC, time_get(), status->channel);
#ifdef  TCP
        write_tcp(status->channel);
#endif  /* TCP */
        if (config->verbose) {
            write_log(config->log_main);
            write_str(status->channel, COL_SYSTEM);
        }
/* SERGEJ */        validate_string(status->chnl[chnl_getnum()].topic);
        snprintf(message, MSG_SIZE, "%s\n", status->chnl[chnl_getnum()].topic);
#ifdef  TCP
        write_tcp(status->channel);
#endif  /* TCP */
        if (config->verbose) {
            write_log(config->log_main);
            write_str(status->channel, COL_SYSTEM);
        }
    }
    refresh_room();
    screen_show();
    refresh_input();
    string_show();
    if ((!config->my_only || !strncmp(status->room->name, status->channel, CHANNEL_MAXLEN)) &&
        (config->mode == MOD_NORMAL)) beep_system();
}
开发者ID:Mermouy,项目名称:archlinux-stuff,代码行数:50,代码来源:pckt_pars.c


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