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


C++ put_string函数代码示例

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


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

示例1: command_run

int16
command_run (void)
{
  int8 *entry_point;
  void
  (*f) (void);

  entry_point = elf_load (xmodem_recv_buffer_start_address);
  if (!entry_point)
    {
      put_string ("run error!\n");
    }
  else
    {
      put_string ("starting from entry point:");
      put_hex ((uint32) entry_point, 6);
      put_string ("\n");
      put_string ("\n");
      f = (void
      (*) (void)) entry_point;
      f ();
    }
  return 0;
}
开发者ID:2dice,项目名称:aki-h8_3069f,代码行数:24,代码来源:command.c

示例2: show_utf8

static void show_utf8(struct membuffer *b, const char *text, const char *pre, const char *post, int is_attribute)
{
    int len;
    char *cleaned;

    if (!text)
        return;
    /* remove leading and trailing space */
    /* We need to combine isascii() with isspace(),
     * because we can only trust isspace() with 7-bit ascii,
     * on windows for example */
    while (isascii(*text) && isspace(*text))
        text++;
    len = strlen(text);
    if (!len)
        return;
    while (len && isascii(text[len - 1]) && isspace(text[len - 1]))
        len--;
    cleaned = strndup(text, len);
    put_string(b, pre);
    quote(b, cleaned, is_attribute);
    put_string(b, post);
    free(cleaned);
}
开发者ID:ngot,项目名称:subsurface,代码行数:24,代码来源:save-xml.c

示例3: rtc_alarm_time

// RTC alarm setup time
static void rtc_alarm_time(void) {
    char flag;
    char buffer[9];
    int temp, temp_time;
    util_clear_screen();
    // setup alarm second
    put_string("en alrm sec(y/n): ");
    flag = get_char();
    if (flag == 'y') {
        temp_time |= AT91C_RTC_SECEN;
        util_clear_screen();
        // update seconds
        put_string("set sec: ");
        get_string(buffer, 2, 1);
        temp = util_hex_to_int(buffer);
        if (temp >= 0x00 && temp <= 0x59) {
            temp_time |= temp & AT91C_RTC_SEC;
        }
        util_clear_screen();
    }
    // setup alarm minute
    put_string("en alrm min(y/n): ");
    flag = get_char();
    if (flag == 'y') {
        temp_time |= AT91C_RTC_MINEN;
        util_clear_screen();
        // update minutes
        put_string("set min: ");
        get_string(buffer, 2, 1);
        temp = util_hex_to_int(buffer);
        if (temp >= 0x00 && temp <= 0x59) {
            temp_time |= (temp << 8) & AT91C_RTC_MIN;
        }
        util_clear_screen();
    }
    // setup alarm minute
    put_string("en alrm hour(y/n): ");
    flag = get_char();
    if (flag == 'y') {
        temp_time |= AT91C_RTC_HOUREN;
        util_clear_screen();
        // update hours
        put_string("set hour: ");
        get_string(buffer, 2, 1);
        temp = util_hex_to_int(buffer);
        if (temp >= 0x00 && temp <= 0x23) {
            temp_time |= (temp << 16) & AT91C_RTC_HOUR;
        }
        util_clear_screen();
    }
    if (temp_time & AT91C_RTC_SECEN) {
        AT91C_BASE_RTC->RTC_TIMALR = temp_time;
        AT91C_BASE_RTC->RTC_IER |= AT91C_RTC_ALARM;
    }
}
开发者ID:no111u3,项目名称:arm_my_learn,代码行数:56,代码来源:rtc_alarm.c

示例4: init_fat

init_fat(){
	/* enable everdrive card */
	clearFATBuffers();
	ed_begin();
	put_string("Initialise", 0, 1);
	everdrive_error = disk_init();
	put_number(everdrive_error, 3, 0, 2);
	everdrive_error = getMBR(0);
	put_number(everdrive_error, 3, 4, 2);
	everdrive_error = getFATVol();
	put_number(everdrive_error, 3, 8, 2);
	everdrive_error = getFATFS();
	put_number(everdrive_error, 3, 12, 2);
	/* NOTE: You should normally check that each call to the above 4 functions
	has returned correctly before proceeding! */
}
开发者ID:BlockoS,项目名称:everdrive-fat,代码行数:16,代码来源:test-files.c

示例5: put_dynimport_decl

static int put_dynimport_decl(asymbol * sym, void *arg)
{
  char dynimport_decl[1024];
  const char *func_name = sym->name;
  int fd = (int)arg;

  /* Put the declaration for the dynamic info structure */
  if (func_name)
    {
      sprintf(dynimport_decl, dynimport_decl_format,
              MKINFODECLARGS(func_name, counter));
      put_string(fd, dynimport_decl);
      counter++;
    }
  return 0;
}
开发者ID:andrewms,项目名称:nuttx_ap,代码行数:16,代码来源:mknxflat.c

示例6: put_string

 void
 RTMPSession::sendCreateStream()
 {
     RTMPChunk_0 metadata = {{0}};
     metadata.msg_stream_id = kControlChannelStreamId;
     metadata.msg_type_id = RTMP_PT_INVOKE;
     std::vector<uint8_t> buff;
     put_string(buff, "createStream");
     m_createStreamInvoke = ++m_numberOfInvokes;
     m_trackedCommands[m_numberOfInvokes] = "createStream";
     put_double(buff, m_createStreamInvoke);
     put_byte(buff, kAMFNull);
     metadata.msg_length.data = static_cast<int>( buff.size() );
     
     sendPacket(&buff[0], buff.size(), metadata);
 }
开发者ID:1072258106,项目名称:LiveVideoCoreSDK,代码行数:16,代码来源:RTMPSession.cpp

示例7: st_handler

// system timer handler
extern void st_handler(void) {
    int status = AT91C_BASE_ST->ST_SR & AT91C_BASE_ST->ST_IMR;
    // handler of pit
    if (status & AT91C_ST_PITS) {
        AT91C_BASE_PIOB->PIO_ODSR ^= AT91C_PIO_PB0;
    }
    // handler of rtt - rttinc
    if (status & AT91C_ST_RTTINC) {
        AT91C_BASE_PIOB->PIO_ODSR ^= AT91C_PIO_PB27;
    }
    // handler of rtt - alms
    if (status & AT91C_ST_ALMS) {
        put_string("Simple message\n");
        AT91C_BASE_ST->ST_RTAR += 40;
    }
}
开发者ID:no111u3,项目名称:arm_my_learn,代码行数:17,代码来源:main.c

示例8: main

int
main (int argc, char **argv)
{
  char *command_line;
  header the_header;
  long name_length;
  char *mail_program_name;
  char buf[BUFLEN + 1];
  register int size;
  FILE *the_pipe;

  extern char *getenv (const char *);

  mail_program_name = getenv ("FAKEMAILER");
  if (!(mail_program_name && *mail_program_name))
    mail_program_name = MAIL_PROGRAM_NAME;
  name_length = strlen (mail_program_name);

  my_name = MY_NAME;
  the_streams = ((stream_list) NULL);
  the_date = ((char *) NULL);
  the_user = ((char *) NULL);

  the_header = read_header ();
  command_line = alloc_string (name_length + args_size (the_header));
  strcpy (command_line, mail_program_name);
  parse_header (the_header, &command_line[name_length]);

  the_pipe = popen (command_line, "w");
  if (the_pipe == ((FILE *) NULL))
    fatal ("cannot open pipe to real mailer");

  add_a_stream (the_pipe, pclose);

  write_header (the_header);

  /* Dump the message itself */

  while (!feof (stdin))
    {
      size = fread (buf, 1, BUFLEN, stdin);
      buf[size] = '\0';
      put_string (buf);
    }

  exit (close_the_streams ());
}
开发者ID:oscarfv,项目名称:emacs,代码行数:47,代码来源:fakemail.c

示例9: nice_copy

int nice_copy(char *title, char *source, char *dest)
{
  int x1=0,y1=0,x2=79,y2=25;
  bar(x1,y1+1,x2,y2,176,0x01);
  put_title(title);

  box(x1,(y1+y2)/2-1,x2,(y1+y2)/2+3,0x17);
  bar(x1+1,(y1+y2)/2,x2-1,(y1+y2)/2+2,' ',0x17);
  
  char msg[100];
  sprintf(msg,"Copying %s -> %s",source,dest);
  put_string(x1+1,(y1+y2)/2,msg,0x17);
  bar(x1+1,(y1+y2)/2+2,x2-1,(y1+y2)/2+2,176,0x17);

  char *buffer=(char *)jmalloc(0xf000,"read buf");
  if (!buffer) return 0;
  FILE *out=fopen(dest,"wb");
  if (!out) { jfree(buffer) ; return 0; }
  FILE *in=fopen(source,"rb");
  if (!in) { jfree(buffer); fclose(out); unlink(dest); return 0; }

  fseek(in,0,SEEK_END);
  long size=ftell(in);
  fseek(in,0,SEEK_SET);
  int osize=size;
  while (size)
  {
    long tr=fread(buffer,1,0xf000,in);
    bar(x1+1,(y1+y2)/2+2,x1+1+(x2-x1)*(osize-size-tr)/osize,(y1+y2)/2+2,178,0x17);

    if (fwrite(buffer,1,tr,out)!=tr)
    {
      fclose(out);
      fclose(in);
      unlink(dest);
      jfree(buffer);
      return 0;
    }
    size-=tr;
    
  }
  fclose(in);
  fclose(out);
  jfree(buffer);
  cls();
  return 1;
}
开发者ID:spippolatore,项目名称:abuse,代码行数:47,代码来源:text_gui.c

示例10: syslinux_execute

void syslinux_execute(void)
{
	char *device, *diskdevice;
	char *bootimages;
	int fd;

	if (strcmp(hashmapGetPrintf(ictx.opts, "none", BASE_BOOTLOADER),
				"syslinux"))
		return;

	pr_info("Writing MBR");
        diskdevice = xasprintf("/dev/block/%s",
			hashmapGetPrintf(ictx.opts, NULL, BASE_INSTALL_DISK));
	dd(SYSLINUX_MBR, diskdevice);
        free(diskdevice);

	/* SYSLINUX complains if this isn't done */
	chmod("/tmp", 01777);

	bootimages = hashmapGetPrintf(ictx.opts, NULL, BASE_BOOT_LIST);
	device = hashmapGetPrintf(ictx.opts, NULL, "partition.bootloader:device");
	pr_info("Installing ldlinux.sys onto %s", device);
	do_install_syslinux(device);

	/* In case we die() before we are finished */
	signal(SIGABRT, sighandler);
	mount_partition_device(device, "vfat", BOOTLOADER_PATH);

	pr_info("Copying syslinux support files");
	copy_file(IMAGES_PATH "vesamenu.c32", BOOTLOADER_PATH "vesamenu.c32");
	copy_file(IMAGES_PATH "android.c32", BOOTLOADER_PATH "android.c32");

	pr_info("Constructing syslinux.cfg");
	/* Put the initial template stuff in */
	copy_file(SYSLINUX_CFG_TEM_FN, SYSLINUX_CFG_FN);
	fd = xopen(SYSLINUX_CFG_FN, O_WRONLY | O_APPEND);
	put_string(fd, "menu androidcommand %s\n",
		hashmapGetPrintf(ictx.opts, NULL, "partition.misc:index"));
	string_list_iterate(bootimages, bootimage_cb, &fd);

	xclose(fd);
	umount(BOOTLOADER_PATH);
	rmdir(BOOTLOADER_PATH);
	signal(SIGABRT, SIG_DFL);
	pr_info("SYSLINUX installation complete");
}
开发者ID:quanganh2627,项目名称:platform_bootable_iago,代码行数:46,代码来源:iago-syslinux.c

示例11: print_can_frame

/*! \fn       int32 print_can_frame(void)
*
*  \brief     打印CAN帧
*
*  \param     无
*
*  \exception 无
*
*  \return    EXIT_FAILURE:失败;EXIT_SUCCESS:成功
*/
int32 print_can_frame(void)
{
    int32 lRet = EXIT_SUCCESS;

    if(s_unCanSegMsgReadIndex != s_unCanSegMsgWriteIndex)
    {
        put_string(" ");
        lRet = print_protocol_frame(&(s_aucCanSegMsgBuf[s_unCanSegMsgReadIndex][0]));
        s_unCanSegMsgReadIndex++;
        if(CAN_MSG_BUF_SIZE <= s_unCanSegMsgReadIndex)
        {
            s_unCanSegMsgReadIndex = 0;
        }
    }

    return lRet;
}
开发者ID:BGCX262,项目名称:zuokong-googlesvn-svn-to-git,代码行数:27,代码来源:can.c

示例12: put_dynimport_array

static int put_dynimport_array(asymbol * sym, void *arg)
{
  char dynimport_array[1024];
  const char *func_name = sym->name;
  int fd = (int)arg;

  /* Create the dynimport_array */

  if (func_name)
    {
      sprintf(dynimport_array, dynimport_array_format,
              MKINFOARGS(func_name, counter));
      put_string(fd, dynimport_array);
      counter++;
    }
  return 0;
}
开发者ID:andrewms,项目名称:nuttx_ap,代码行数:17,代码来源:mknxflat.c

示例13: put_import_name

static int put_import_name(asymbol * sym, void *arg)
{
  char import_name[512];
  const char *func_name = sym->name;
  int fd = (int)arg;

  /* Create the import_name */

  if (func_name)
    {
      sprintf(import_name, import_name_strtab_format,
              MKIMPSTRTABARG(func_name, counter));
      put_string(fd, import_name);
      counter++;
    }
  return 0;
}
开发者ID:andrewms,项目名称:nuttx_ap,代码行数:17,代码来源:mknxflat.c

示例14: quote

/*
 * We're outputting utf8 in xml.
 * We need to quote the characters <, >, &.
 *
 * Technically I don't think we'd necessarily need to quote the control
 * characters, but at least libxml2 doesn't like them. It doesn't even
 * allow them quoted. So we just skip them and replace them with '?'.
 *
 * If we do this for attributes, we need to quote the quotes we use too.
 */
static void quote(struct membuffer *b, const char *text, int is_attribute)
{
	const char *p = text;

	for (;;) {
		const char *escape;

		switch (*p++) {
		default:
			continue;
		case 0:
			escape = NULL;
			break;
		case 1 ... 8:
		case 11:
		case 12:
		case 14 ... 31:
			escape = "?";
			break;
		case '<':
			escape = "&lt;";
			break;
		case '>':
			escape = "&gt;";
			break;
		case '&':
			escape = "&amp;";
			break;
		case '\'':
			if (!is_attribute)
				continue;
			escape = "&apos;";
			break;
		case '\"':
			if (!is_attribute)
				continue;
			escape = "&quot;";
			break;
		}
		put_bytes(b, text, (p - text - 1));
		if (!escape)
			break;
		put_string(b, escape);
		text = p;
	}
}
开发者ID:joscandreu,项目名称:subsurface,代码行数:56,代码来源:save-xml.c

示例15: defined

static ipc_msg_hdr *create_hdr(uint32_t op, size_t *len, char **data_start, int reuse_socket)
    {
    char *msg = NULL;
    ipc_msg_hdr *hdr;
    int datalen;
#if !defined(USE_TCP_LOOPBACK)
    char ctrl_path[256];
#endif

    if (!reuse_socket)
        {
#if defined(USE_TCP_LOOPBACK)
		*len += 2;  // Allocate space for two-byte port number
#else
		struct timeval time;
		if (gettimeofday(&time, NULL) < 0) return NULL;
		sprintf(ctrl_path, "%s%d-%.3lx-%.6lu", CTL_PATH_PREFIX, (int)getpid(),
			(unsigned long)(time.tv_sec & 0xFFF), (unsigned long)(time.tv_usec));
        *len += strlen(ctrl_path) + 1;
#endif
        }

    datalen = (int) *len;
    *len += sizeof(ipc_msg_hdr);

    // write message to buffer
    msg = malloc(*len);
    if (!msg) return NULL;

    bzero(msg, *len);
    hdr = (void *)msg;
    hdr->datalen = datalen;
    hdr->version = VERSION;
    hdr->op = op;
    if (reuse_socket) hdr->flags |= IPC_FLAGS_REUSE_SOCKET;
    *data_start = msg + sizeof(ipc_msg_hdr);
#if defined(USE_TCP_LOOPBACK)
	// Put dummy data in for the port, since we don't know what
	// it is yet.  The data will get filled in before we
	// send the message. This happens in deliver_request().
	if (!reuse_socket)  put_short(0, data_start);
#else
    if (!reuse_socket)  put_string(ctrl_path, data_start);
#endif
    return hdr;
    }
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:46,代码来源:dnssd_clientstub.c


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