• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PUTCHAR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ChapSendResponse

/* ARGSUSED */
static void
ChapSendResponse(
    chap_state *cstate)
{
    u_char *outp;
    int outlen, md_len, name_len;

    md_len = cstate->resp_length;
    name_len = strlen(cstate->resp_name);
    outlen = CHAP_HEADERLEN + sizeof (u_char) + md_len + name_len;
    outp = outpacket_buf;

    MAKEHEADER(outp, PPP_CHAP);

    PUTCHAR(CHAP_RESPONSE, outp);	/* we are a response */
    PUTCHAR(cstate->resp_id, outp);	/* copy id from challenge packet */
    PUTSHORT(outlen, outp);		/* packet length */

    PUTCHAR(md_len, outp);		/* length of MD */
    BCOPY(cstate->response, outp, md_len);	/* copy MD to buffer */
    INCPTR(md_len, outp);

    BCOPY(cstate->resp_name, outp, name_len); /* append our name */

    /* send the packet */
    output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);

    cstate->clientstate = CHAPCS_RESPONSE;
    TIMEOUT(ChapResponseTimeout, cstate, cstate->timeouttime);
    ++cstate->resp_transmits;
}
开发者ID:AoLaD,项目名称:rtems,代码行数:32,代码来源:chap.c


示例2: upap_sauthreq

/*
 * upap_sauthreq - Send an Authenticate-Request.
 */
static void
upap_sauthreq(upap_state *u)
{
  u_char *outp;
  int outlen;

  outlen = UPAP_HEADERLEN + 2 * sizeof (u_char) 
         + u->us_userlen + u->us_passwdlen;
  outp = outpacket_buf[u->us_unit];

  MAKEHEADER(outp, PPP_PAP);

  PUTCHAR(UPAP_AUTHREQ, outp);
  PUTCHAR(++u->us_id, outp);
  PUTSHORT(outlen, outp);
  PUTCHAR(u->us_userlen, outp);
  BCOPY(u->us_user, outp, u->us_userlen);
  INCPTR(u->us_userlen, outp);
  PUTCHAR(u->us_passwdlen, outp);
  BCOPY(u->us_passwd, outp, u->us_passwdlen);

  pppWrite(u->us_unit, outpacket_buf[u->us_unit], outlen + PPP_HDRLEN);

  UPAPDEBUG((LOG_INFO, "pap_sauth: Sent id %d\n", u->us_id));

  TIMEOUT(upap_timeout, u, u->us_timeouttime);
  ++u->us_transmits;
  u->us_clientstate = UPAPCS_AUTHREQ;
}
开发者ID:krzint,项目名称:Szyfrator_NET,代码行数:32,代码来源:pap.c


示例3: upap_sresp

/*
 * upap_sresp - Send a response (ack or nak).
 */
static void upap_sresp(ppp_pcb *pcb, u_char code, u_char id, const char *msg, int msglen) {
    struct pbuf *p;
    u_char *outp;
    int outlen;

    outlen = UPAP_HEADERLEN + sizeof (u_char) + msglen;
    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +outlen), PPP_CTRL_PBUF_TYPE);
    if(NULL == p)
        return;
    if(p->tot_len != p->len) {
        pbuf_free(p);
        return;
    }

    outp = (u_char*)p->payload;
    MAKEHEADER(outp, PPP_PAP);

    PUTCHAR(code, outp);
    PUTCHAR(id, outp);
    PUTSHORT(outlen, outp);
    PUTCHAR(msglen, outp);
    MEMCPY(outp, msg, msglen);

    ppp_write(pcb, p);
}
开发者ID:crvv,项目名称:lwip,代码行数:28,代码来源:upap.c


示例4: ChapSendStatus

/*
 * ChapSendStatus - Send a status response (ack or nak).
 */
static void
ChapSendStatus(
    chap_state *cstate,
    int code)
{
    u_char *outp;
    int outlen, msglen;
    char msg[256];

    if (code == CHAP_SUCCESS)
	slprintf(msg, sizeof(msg), "Welcome to %s.", hostname);
    else
	slprintf(msg, sizeof(msg), "I don't like you.  Go 'way.");
    msglen = strlen(msg);

    outlen = CHAP_HEADERLEN + msglen;
    outp = outpacket_buf;

    MAKEHEADER(outp, PPP_CHAP);	/* paste in a header */

    PUTCHAR(code, outp);
    PUTCHAR(cstate->chal_id, outp);
    PUTSHORT(outlen, outp);
    BCOPY(msg, outp, msglen);
    output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
}
开发者ID:AoLaD,项目名称:rtems,代码行数:29,代码来源:chap.c


示例5: upap_sauthreq

/*
 * upap_sauthreq - Send an Authenticate-Request.
 */
static void upap_sauthreq(ppp_pcb *pcb) {
    struct pbuf *p;
    u_char *outp;
    int outlen;

    outlen = UPAP_HEADERLEN + 2 * sizeof (u_char) +
             pcb->upap.us_userlen + pcb->upap.us_passwdlen;
    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +outlen), PPP_CTRL_PBUF_TYPE);
    if(NULL == p)
        return;
    if(p->tot_len != p->len) {
        pbuf_free(p);
        return;
    }

    outp = (u_char*)p->payload;
    MAKEHEADER(outp, PPP_PAP);

    PUTCHAR(UPAP_AUTHREQ, outp);
    PUTCHAR(++pcb->upap.us_id, outp);
    PUTSHORT(outlen, outp);
    PUTCHAR(pcb->upap.us_userlen, outp);
    MEMCPY(outp, pcb->upap.us_user, pcb->upap.us_userlen);
    INCPTR(pcb->upap.us_userlen, outp);
    PUTCHAR(pcb->upap.us_passwdlen, outp);
    MEMCPY(outp, pcb->upap.us_passwd, pcb->upap.us_passwdlen);

    ppp_write(pcb, p);

    TIMEOUT(upap_timeout, pcb, pcb->settings.pap_timeout_time);
    ++pcb->upap.us_transmits;
    pcb->upap.us_clientstate = UPAPCS_AUTHREQ;
}
开发者ID:crvv,项目名称:lwip,代码行数:36,代码来源:upap.c


示例6: set_rime_addr

/*---------------------------------------------------------------------------*/
static void
set_rime_addr(void)
{
    uint8_t *addr_long = NULL;
    uint16_t addr_short = 0;
    char i;

    __xdata unsigned char * macp = &X_IEEE_ADDR;

    PUTSTRING("Rime is 0x");
    PUTHEX(sizeof(rimeaddr_t));
    PUTSTRING(" bytes long\n");

    PUTSTRING("Reading MAC from Info Page\n");

    for(i = (RIMEADDR_SIZE - 1); i >= 0; --i) {
        rimeaddr_node_addr.u8[i] = *macp;
        macp++;
    }

    /* Now the address is stored MSB first */
#if STARTUP_VERBOSE
    PUTSTRING("Rime configured with address ");
    for(i = 0; i < RIMEADDR_SIZE - 1; i++) {
        PUTHEX(rimeaddr_node_addr.u8[i]);
        PUTCHAR(':');
    }
    PUTHEX(rimeaddr_node_addr.u8[i]);
    PUTCHAR('\n');
#endif

    cc2530_rf_set_addr(IEEE802154_PANID);
}
开发者ID:GDanii,项目名称:contiki-mirror-MICAz-IPv6,代码行数:34,代码来源:contiki-main.c


示例7: ChapSendChallenge

/*
 * ChapSendChallenge - Send an Authenticate challenge.
 */
static void
ChapSendChallenge(
    chap_state *cstate)
{
    u_char *outp;
    int chal_len, name_len;
    int outlen;

    chal_len = cstate->chal_len;
    name_len = strlen(cstate->chal_name);
    outlen = CHAP_HEADERLEN + sizeof (u_char) + chal_len + name_len;
    outp = outpacket_buf;

    MAKEHEADER(outp, PPP_CHAP);		/* paste in a CHAP header */

    PUTCHAR(CHAP_CHALLENGE, outp);
    PUTCHAR(cstate->chal_id, outp);
    PUTSHORT(outlen, outp);

    PUTCHAR(chal_len, outp);		/* put length of challenge */
    BCOPY(cstate->challenge, outp, chal_len);
    INCPTR(chal_len, outp);

    BCOPY(cstate->chal_name, outp, name_len);	/* append hostname */

    output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);

    TIMEOUT(ChapChallengeTimeout, cstate, cstate->timeouttime);
    ++cstate->chal_transmits;
}
开发者ID:AoLaD,项目名称:rtems,代码行数:33,代码来源:chap.c


示例8: do_conversion_string

static int
do_conversion_string (const char *str, int f, int width, int precision,
		      int (*func)(int c, void *data), void *data)
{
	int len;
	int n = 0;
	int leftsp = 0, rightsp = 0;

	len = 0;
	while (!((f & HAS_PRECISION) && len >= precision) &&
	       str[len] != '\0')
		len++;
	if ((f & HAS_WIDTH) && width > len) {
		if (f & FLAG_LEFT_ADJUSTED)
			rightsp = width - len;
		else
			leftsp = width - len;
	}
	while (leftsp--)
		PUTCHAR (' ');
	while (len--)
		PUTCHAR (*str++);
	while (rightsp--)
		PUTCHAR (' ');
error:
	return n;
}
开发者ID:anbangr,项目名称:bitvisor-dev,代码行数:27,代码来源:lib_printf.c


示例9: main

int main()
{
	
	int t;
	t=readInt();
	while(t--)
	{
		int num=103993%33102;
		int den=33102;
		int n;
		n=readInt();
		
		PUTCHAR('3');
		if(n>0)
		{
			PUTCHAR('.');
			while(n)
			{
				num=num*10;
				PUTCHAR('0'+num/den);
				num=num%den;
				n--;
			}			
		}
		PUTCHAR('\n');
	}
	return 0;
}
开发者ID:PeacefulAbhyasi,项目名称:Competitive-Programming,代码行数:28,代码来源:APPROXC.cpp


示例10: fsm_sdata

/*
 * fsm_sdata - Send some data.
 *
 * Used for all packets sent to our peer by this module.
 */
void fsm_sdata(fsm *f, u_char code, u_char id, const u_char *data, int datalen) {
    ppp_pcb *pcb = f->pcb;
    struct pbuf *p;
    u_char *outp;
    int outlen;

    /* Adjust length to be smaller than MTU */
    if (datalen > pcb->peer_mru - HEADERLEN)
	datalen = pcb->peer_mru - HEADERLEN;
    outlen = datalen + HEADERLEN;

    p = pbuf_alloc(PBUF_RAW, (u16_t)(outlen + PPP_HDRLEN), PPP_CTRL_PBUF_TYPE);
    if(NULL == p)
        return;
    if(p->tot_len != p->len) {
        pbuf_free(p);
        return;
    }

    outp = (u_char*)p->payload;
    if (datalen) /* && data != outp + PPP_HDRLEN + HEADERLEN)  -- was only for fsm_sconfreq() */
	MEMCPY(outp + PPP_HDRLEN + HEADERLEN, data, datalen);
    MAKEHEADER(outp, f->protocol);
    PUTCHAR(code, outp);
    PUTCHAR(id, outp);
    PUTSHORT(outlen, outp);
    ppp_write(pcb, p);
}
开发者ID:MuesliReep,项目名称:STM-Nucleo-F746ZG-TCP-UDP-example,代码行数:33,代码来源:fsm.c


示例11: my_puts

void my_puts(char *s)
{
  while(*s)
    PUTCHAR(*s++);

  PUTCHAR('\n');
}
开发者ID:phanirajkiran,项目名称:cs107e.github.io,代码行数:7,代码来源:program.c


示例12: SendKeys

void
SendKeys (int player, int c)
{
  PUTHEAD (SKEY);
  PUTCHAR (buffer + HEADSIZE, c);
  PUTCHAR (buffer + HEADSIZE + 1, player);
  csendreliable (buffer, HEADSIZE + 2);
}
开发者ID:senquack,项目名称:Koules-for-Handhelds,代码行数:8,代码来源:client.c


示例13: SendRotation

void
SendRotation (int player, int c)
{
  PUTHEAD (SROT);
  PUTCHAR (buffer + HEADSIZE, c);
  PUTCHAR (buffer + HEADSIZE + 1, player);
  csendreliable (buffer, HEADSIZE + 2);
}
开发者ID:senquack,项目名称:Koules-for-Handhelds,代码行数:8,代码来源:client.c


示例14: printf_response

/*********************************************************************************************************
 * Function to print a modem response to the serial terminal
 * This function is used instead of printf because the PE Micro terminal only sends \r for a keyboard entry
 * The function adds a \n to every \r received
 ************************************************************************************************************/
void printf_response(char * ptr)
{
	while(*ptr != '\0')
	{
		PUTCHAR(*ptr);
		if(*ptr++ == '\r')
			PUTCHAR('\n');
	}
}
开发者ID:saoirse-stewie,项目名称:Project-,代码行数:14,代码来源:Uart_gsm.c


示例15: fsm_sconfreq

/*
 * fsm_sconfreq - Send a Configure-Request.
 */
static void fsm_sconfreq(fsm *f, int retransmit) {
    ppp_pcb *pcb = f->pcb;
    struct pbuf *p;
    u_char *outp;
    int cilen;

    if( f->state != PPP_FSM_REQSENT && f->state != PPP_FSM_ACKRCVD && f->state != PPP_FSM_ACKSENT ){
	/* Not currently negotiating - reset options */
	if( f->callbacks->resetci )
	    (*f->callbacks->resetci)(f);
	f->nakloops = 0;
	f->rnakloops = 0;
    }

    if( !retransmit ){
	/* New request - reset retransmission counter, use new ID */
	f->retransmits = pcb->settings.fsm_max_conf_req_transmits;
	f->reqid = ++f->id;
    }

    f->seen_ack = 0;

    /*
     * Make up the request packet
     */
    if( f->callbacks->cilen && f->callbacks->addci ){
	cilen = (*f->callbacks->cilen)(f);
	if( cilen > pcb->peer_mru - HEADERLEN )
	    cilen = pcb->peer_mru - HEADERLEN;
    } else
	cilen = 0;

    p = pbuf_alloc(PBUF_RAW, (u16_t)(cilen + HEADERLEN + PPP_HDRLEN), PPP_CTRL_PBUF_TYPE);
    if(NULL == p)
        return;
    if(p->tot_len != p->len) {
        pbuf_free(p);
        return;
    }

    /* send the request to our peer */
    outp = (u_char*)p->payload;
    MAKEHEADER(outp, f->protocol);
    PUTCHAR(CONFREQ, outp);
    PUTCHAR(f->reqid, outp);
    PUTSHORT(cilen + HEADERLEN, outp);
    if (cilen != 0) {
	(*f->callbacks->addci)(f, outp, &cilen);
	LWIP_ASSERT("cilen == p->len - HEADERLEN - PPP_HDRLEN", cilen == p->len - HEADERLEN - PPP_HDRLEN);
    }

    ppp_write(pcb, p);

    /* start the retransmit timer */
    --f->retransmits;
    TIMEOUT(fsm_timeout, f, pcb->settings.fsm_timeout_time);
}
开发者ID:MuesliReep,项目名称:STM-Nucleo-F746ZG-TCP-UDP-example,代码行数:60,代码来源:fsm.c


示例16: SendJoystick

void
SendJoystick (int player, int x, int y, int buttons)
{
  PUTHEAD (SJOYSTICK);
  PUTSHORT (buffer + HEADSIZE, x);
  PUTSHORT (buffer + HEADSIZE + 2, y);
  PUTCHAR (buffer + HEADSIZE + 4, buttons);
  PUTCHAR (buffer + HEADSIZE + 5, player);
  csendreliable (buffer, HEADSIZE + 6);
}
开发者ID:senquack,项目名称:Koules-for-Handhelds,代码行数:10,代码来源:client.c


示例17: SendMouse

void
SendMouse (int player, int x, int y, int buttons)
{
  PUTHEAD (SMOUSE);
  PUTSHORT (buffer + HEADSIZE, x);
  PUTSHORT (buffer + HEADSIZE + 2, y);
  PUTCHAR (buffer + HEADSIZE + 4, buttons);
  PUTCHAR (buffer + HEADSIZE + 5, player);
  csendreliable (buffer, HEADSIZE + 6);
}
开发者ID:senquack,项目名称:Koules-for-Handhelds,代码行数:10,代码来源:client.c


示例18: GetString

//-----------------------------------------------------------------------------
// GetString
//-----------------------------------------------------------------------------
//
// Return Value : Pointer to string containing buffer read from UART.
// Parameters   : <buf> to store string; maximum <n>umber of characters to
//                read; <n> must be 2 or greater.
//
// This function returns a string of maximum length <n>.
//-----------------------------------------------------------------------------
int GetString()
{
	char c;
	int len = 0;
	char *buffer = Command;
	int max_length = sizeof(Command) - 1;

	SetLedPeriod(900, 100);
	printf("READY\r\n> ");

	while(1)
	{
		c = GETCHAR();
		if (c != '\0')
		{
			if (c == '\b' || c == 0x7F)
			{
				if (len != 0)
				{
					PUTCHAR(c);
					--len;
					--buffer;
				}
			}
			else if (c == '\r' || c == '\n')
			{
				SetLedPeriod(0, 0);
				PUTCHAR('\n');
				if (max_length == 0)
				{
					printf("Result: FF COMMAND_TOO_LONG\n");
					buffer = Command;
				}
				*buffer = '\0';
				return len;
			}
			else if (len != max_length)
			{
				PUTCHAR(c);
				*buffer++ = c;
				len++;
			}
			else
			{
				max_length = 0;
				len = 0;
			}
		}
	}
}
开发者ID:conorpp,项目名称:C2.Flash,代码行数:60,代码来源:C2_Main.c


示例19: UARTCharPut

void UARTCharPut(unsigned long ulBase, unsigned char ucData)
/*****************************************************************************
 * Function:    See header file.
 ****************************************************************************/
{
  PUTCHAR(ucData);
}
开发者ID:anbae12,项目名称:Code,代码行数:7,代码来源:uartprintf.c


示例20: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(border_router_process, ev, data)
{
  static struct etimer et;

  PROCESS_BEGIN();
  PUTSTRING("Border Router started\n");
  prefix_set = 0;

  leds_on(LEDS_GREEN);

  /* Request prefix until it has been received */
  while(!prefix_set) {
    leds_on(LEDS_RED);
    PUTSTRING("Prefix request.\n");
    etimer_set(&et, CLOCK_SECOND);
    request_prefix();
    leds_off(LEDS_RED);
    PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
  }
  /* We have created a new DODAG when we reach here */
  PUTSTRING("On Channel ");
  PUTDEC(cc2530_rf_channel_get());
  PUTCHAR('\n');

  print_local_addresses();

  leds_off(LEDS_GREEN);

  PROCESS_EXIT();

  PROCESS_END();
}
开发者ID:1uk3,项目名称:contiki,代码行数:33,代码来源:border-router.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PUTENV函数代码示例发布时间:2022-05-30
下一篇:
C++ PUTC函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap