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


C++ PUTCHAR函数代码示例

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


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


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