您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ strlen_P函数代码示例

51自学网 2021-06-03 08:31:07
  C++
这篇教程C++ strlen_P函数代码示例写得很实用,希望能帮到您。

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

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

示例1: strstr_P

// Parse a quoted string in the response fields and copy its value (without quotes)// to the specified character array (v).  Only up to maxlen characters are copied// into the result buffer, so make sure to pass a large enough buffer to handle the// response.boolean FonaSMS::parseReplyQuoted(const __FlashStringHelper *toreply,          char *v, int maxlen, char divider, uint8_t index) {  uint8_t i=0, j;  // Verify response starts with toreply.  char *p = strstr_P(replybuffer, (prog_char*)toreply);  if (p == 0) return false;  p+=strlen_P((prog_char*)toreply);  // Find location of desired response field.  for (i=0; i<index;i++) {    // increment dividers    p = strchr(p, divider);    if (!p) return false;    p++;  }  // Copy characters from response field into result string.  for(i=0, j=0; j<maxlen && i<strlen(p); ++i) {    // Stop if a divier is found.    if(p[i] == divider)      break;    // Skip any quotation marks.    else if(p[i] == '"')      continue;    v[j++] = p[i];  }  // Add a null terminator if result string buffer was not filled.  if (j < maxlen)    v[j] = '/0';  return true;}
开发者ID:StabbyCutyou,项目名称:FonaSMS,代码行数:37,


示例2: strlen_P

bool ESP8266proConnection::internalSend(const __FlashStringHelper* dataP, const char* dataR){	bool ok;	int len = 0;	if (dataP != NULL)		len += strlen_P(reinterpret_cast<PGM_P>(dataP));	if (dataR != NULL)		len += strlen(dataR);	uint8_t id = getId();	if (id == ESP_INVALID_CONNECTION) return false;	parent.execute((String)"AT+CIPSEND=" + id + "," + len, eCEM_NoResponse);			// Write request data	if (dataP != NULL)		parent.writeString(dataP);		ok = parent.execute(dataR!= NULL ? dataR : "", eCEM_NoLineBreak);	if (!ok) return false;		// Wait "SEND OK" response	for (uint8_t i = 0; i < 3; i++)	{		if (getId() == ESP_INVALID_CONNECTION) return false; // Already closed..		if (parent.getState() == ePS_Completed) return true;		if (!parent.execute("", eCEM_NoLineBreak)) return false;	}		return false;}
开发者ID:uudecode,项目名称:ESP8266pro,代码行数:30,


示例3: invalidate

String & String::operator = (const __FlashStringHelper *pstr){	if (pstr) copy(pstr, strlen_P((PGM_P)pstr));	else invalidate();	return *this;}
开发者ID:aquilleph,项目名称:cubensis,代码行数:7,


示例4: page

int ThingSpeak::Channel::post(const char* entry, str_P status){  // Use an iostream for the http post request  Socket* sock = m_client->m_sock;  IOStream page(sock);  size_t length = strlen(entry);  if (status != NULL) length += strlen_P(status) + 8;  // Connect to the server  int res = m_client->connect();  if (res < 0) goto error;  // Generate the http post request with entry and status  page << PSTR("POST /update HTTP/1.1") << CRLF       << PSTR("Host: api.thingspeak.com") << CRLF       << PSTR("Connection: close") << CRLF       << PSTR("X-THINGSPEAKAPIKEY: ") << m_key << CRLF       << PSTR("Content-Type: application/x-www-form-urlencoded") << CRLF       << PSTR("Content-Length: ") << strlen(entry) << CRLF       << CRLF       << (char*) entry;  if (status != NULL) page << PSTR("&status=") << status;  sock->flush();  res = 0; error:  // Disconnect and close the socket. Reopen for the next post (if any)  m_client->disconnect();  return (res);}
开发者ID:jimblair,项目名称:Cosa,代码行数:31,


示例5: uecmd_sender_net_main

voiduecmd_sender_net_main(void) {  if (uip_newdata()) {    if(ucallback) {      ucallback(uip_appdata, uip_len);    }    send_data = NULL;  }  if (send_data) {    resend_counter --;    if (!resend_counter) {      if(ucallback) {	ucallback(NULL, 0);      }      send_data = NULL;      return;    }    uint8_t len = strlen_P(send_data);    memcpy_P(uip_appdata, send_data, len);    uip_slen = len;    /* build a new connection on the stack */    ecmd_conn->rport = HTONS(2701);    uip_udp_conn = ecmd_conn;    uip_process(UIP_UDP_SEND_CONN);    router_output();  }}
开发者ID:Leerzeichen,项目名称:ethersex,代码行数:31,


示例6: function_file_stats

static unsigned short function_file_stats(char* buffer, int bufsize) {    unsigned short len = 0;    // list as many files as fit into the buffer    for (int i = 0; len < bufsize; i++) {        // name fo the file        char* name = httpd_fs_getName(i);        // break if there is no file left anmyore        if (name == 0) {            break;        }        // we cant simply pass the filename to snprintf because it is in        // program memory and snprintf requires strings in RAM.        strncpy_P(buffer + len, file_stat_formatter1, bufsize - len);        len += sizeof (file_stat_formatter1);        if (len < bufsize - len) {            char* name = httpd_fs_getName(i);            strncpy_P(buffer + len, name, bufsize - len);            len += strlen_P(name);        }        if (len < bufsize - len) {            int count = httpd_fs_getCount(i);            len += snprintf_P(buffer + len, bufsize - len, file_stat_formatter2, count);        }    }    return len;}
开发者ID:housecream,项目名称:restmcu,代码行数:26,


示例7:

byte ESP8266_Simple::sendCommand(const __FlashStringHelper *cmd){  char cmdBuffer[strlen_P((const char *)cmd)+1];  strcpy_P(cmdBuffer, (const char *) cmd);     return this->sendCommand(cmdBuffer, NULL, 0);  }
开发者ID:Jacobfreida,项目名称:ESP8266_Simple,代码行数:7,


示例8: parse_cmd_pin_list

/** * Get all named pins in a list (separator is the newline character). * Warning: this funtion return only that much entries that fit into * the output buffer. * */int16_t parse_cmd_pin_list(char *cmd, char *output, uint16_t len){    uint16_t help_len = 0;	uint8_t counter = 0;	while (1) {		/* get named-pin from array */	    const char *text = (const char *)pgm_read_word(&portio_pincfg[ counter++ ].name);		/* leave loop if end of array is reached or output buffer is too small */		if (text == NULL) break;		uint8_t lineLength = strlen_P (text);		if (help_len+lineLength+1>len) break;    	memcpy_P (output, text, lineLength);		output += lineLength;		/* add newline character */		*output = '/n';		++output;    	help_len += lineLength+1;	}	/* Remove last newline character */	if (help_len) --help_len;    return ECMD_FINAL(help_len);}
开发者ID:Leerzeichen,项目名称:ethersex,代码行数:31,


示例9: checkHeader

char* HTTP::checkHeader(char *buff, prog_char *header){   int i;   for (i=0;i<strlen_P(header);i++)       {if (buff[i]!=pgm_read_byte(&header[i])) return NULL;}   return &buff[i];}
开发者ID:kstirben,项目名称:Data-Streams,代码行数:7,


示例10: startLongResponse

/** Version for pages made by multiple modules (to optimize prog space)* amodule: array of PROGMEM module; nm: its dimension*/void HTTP::sendDynResponse(int sk,prog_char* amodule[],uint8_t nm,int npar,char *param[]){  if (amodule==NULL) {respERR(sk);return;}  if ((param==NULL)|(npar<=0)) {sendResponse(sk,amodule,nm);return;}  startLongResponse(sk);  int k;  for (k=0;k<nm;k++)  {    prog_char* page=amodule[k];    if (page==NULL){endLongResponse(sk);return;}     int len=strlen_P(page);    int i,lp=0,np=0,pos=0;	  char c;	  if ((param==NULL)|(npar<=0)) {sendResponse(sk,page);return;}  	while(pos<len)	  {		 lp=0;		 for(i=pos;i<len;i++)     {			 lp++;c=pgm_read_byte(page+i);       if (c=='@')			 {				 if ((np<npar)&(param[np]!=NULL))           {sendChunkResponse(sk,page+pos,lp,param[np]);np++;break;}				 else np++;			 }   		 if ((lp>=MAXC)&(c!='@')) {sendChunkResponse(sk,page+pos,lp,NULL);break;}			 if (i==len-1)sendChunkResponse(sk,page+pos,lp,NULL); 		 }		 pos=pos+lp;    }  }  endLongResponse(sk);}
开发者ID:kstirben,项目名称:Data-Streams,代码行数:38,


示例11: sendDynResponse

/**  Sends dynamically assembled page substituting tag @ with strings found in*  array param[] (array of string: array of char array i.e. array of pointer to*  char array)*  npar is the dimension of this array */	void HTTP::sendDynResponse(int sk,prog_char page[],int npar,char *param[]){	int len=strlen_P(page);  int i,lp=0,np=0,pos=0;	char c;	if ((param==NULL)|(npar<=0)) {sendResponse(sk,page);return;}	startLongResponse(sk);	while(pos<len)	{		 lp=0;		 for(i=pos;i<len;i++)     {			 lp++;c=pgm_read_byte(page+i);       if (c=='@')			 {				 if ((np<npar)&(param[np]!=NULL))           {sendChunkResponse(sk,page+pos,lp,param[np]);np++;break;}				 else np++;			 }   		 if ((lp>=MAXC)&(c!='@')) {sendChunkResponse(sk,page+pos,lp,NULL);break;}			 if (i==len-1)sendChunkResponse(sk,page+pos,lp,NULL); 		 }		 pos=pos+lp;  }	endLongResponse(sk);}
开发者ID:kstirben,项目名称:Data-Streams,代码行数:32,


示例12: setTimeouts

// Equivalent to Arduino Stream find() function, but with search string in// flash/PROGMEM rather than RAM-resident.  Returns true if string found// (any further pending input remains in stream), false if timeout occurs.// Can optionally pass NULL (or no argument) to read/purge the OK+CR/LF// returned by most AT commands.  The ipd flag indicates this call follows// a CIPSEND request and might be broken into multiple sections with +IPD// delimiters, which must be parsed and handled (as the search string may// cross these delimiters and/or contain /r or /n itself).boolean Adafruit_ESP8266::find(Fstr *str, boolean ipd) {  uint8_t  stringLength, matchedLength = 0;  int      c;  boolean  found = false;  uint32_t t, save;  uint16_t bytesToGo = 0;  if(ipd) { // IPD stream stalls really long occasionally, what gives?    save = receiveTimeout;    setTimeouts(ipdTimeout);  }  if(str == NULL) str = F("OK/r/n");  stringLength = strlen_P((Pchr *)str);  if(debug && writing) {    debug->print(F("<--- '"));    writing = false;  }  for(t = millis();;) {    if(ipd && !bytesToGo) {  // Expecting next IPD marker?      if(find(F("+IPD,"))) { // Find marker in stream        for(;;) {          if((c = stream->read()) > 0) { // Read subsequent chars...            if(debug) debug->write(c);            if(c == ':') break;          // ...until delimiter.            bytesToGo = (bytesToGo * 10) + (c - '0'); // Keep count            t = millis();    // Timeout resets w/each byte received          } else if(c < 0) { // No data on stream, check for timeout            if((millis() - t) > receiveTimeout) goto bail;          } else goto bail; // EOD on stream        }      } else break; // OK (EOD) or ERROR    }    if((c = stream->read()) > 0) { // Character received?      if(debug) debug->write(c);   // Copy to debug stream      bytesToGo--;      if(c == pgm_read_byte((Pchr *)str +              matchedLength)) {               // Match next byte?        if(++matchedLength == stringLength) { // Matched whole string?          found = true;                       // Winner!          break;        }      } else {          // Character mismatch; reset match pointer+counter        matchedLength = 0;      }      t = millis();     // Timeout resets w/each byte received    } else if(c < 0) {  // No data on stream, check for timeout      if((millis() - t) > receiveTimeout) break; // You lose, good day sir    } else break;       // End-of-data on stream  }  bail: // Sorry, dreaded goto.  Because nested loops.  if(debug) debug->println('/'');  if(ipd) setTimeouts(save);  return found;}
开发者ID:ENB345-Group43,项目名称:Medication-Dispenser-Code-Raw,代码行数:67,


示例13: lcd12864st_print_P

void lcd12864st_print_P(uint8_t x, uint8_t y, const char *str) {	if ((y >= LCD12864ST_LINES) || (x >= LCD12864ST_COLUMNS))		return;	char *data = lcd12864st_buffer + y * LCD12864ST_COLUMNS + x;	memcpy_P(data, str, MIN((size_t) LCD12864ST_COLUMNS - x, strlen_P(str)));}
开发者ID:DrMcCoy,项目名称:OpenM128-Lib,代码行数:8,


示例14: CreateError

//Создать текст ошибкиvoid CreateError(const char *str_P){	u08 len = strlen_P(str_P);	ErrorText = malloc(len+1);	if (ErrorText != NULL){		strcpy_P(ErrorText, str_P);	}	CmdStartClear();}
开发者ID:AndyKorg,项目名称:CNCDrill,代码行数:9,


示例15: lcd_info_screen

void lcd_info_screen(menuFunc_t cancelMenu, menuFunc_t callbackOnCancel, const char* cancelButtonText, uint8_t direction){  lcd_lib_encoder_pos = 0;  if (lcd_lib_button_pressed && IS_SELECTED_MAIN(0))  {    if (cancelMenu) lcd_change_to_menu(cancelMenu,MAIN_MENU_ITEM_POS(0), direction);    if (callbackOnCancel) callbackOnCancel();  }  lcd_basic_screen();  if (!cancelButtonText) cancelButtonText = LS(PSTR("CANCEL"),                                               PSTR("/xD8" "/x80"  "/xD9" "/x80"  ),                                               PSTR("/xFF" "/x82"  "/xC6" "/x82"  )) ;      switch (languageType) {  case LANGUAGE_CHINESE:  case LANGUAGE_KOREAN:    if (IS_SELECTED_MAIN(0))    {      lcd_lib_draw_box(3+3, 54-3+1, 63+61-3, 64-1);      lcd_lib_set(3+4, 54-3+2, 63+61-4, 64-2);      lcd_lib_clear_stringP(65 - strlen_P(cancelButtonText) * 3, 56-3, cancelButtonText);    }else{      lcd_lib_draw_stringP(65 - strlen_P(cancelButtonText) * 3, 56-3, cancelButtonText);    }    break;  case LANGUAGE_ENGLISH:    if (IS_SELECTED_MAIN(0))    {      lcd_lib_draw_box(3+3, 54+1, 63+61-3, 64-1);      lcd_lib_set(3+4, 54+2, 63+61-4, 64-2);      lcd_lib_clear_stringP(65 - strlen_P(cancelButtonText) * 3, 56, cancelButtonText);    }else{      lcd_lib_draw_stringP(65 - strlen_P(cancelButtonText) * 3, 56, cancelButtonText);    }    break;  default:    break;  }}
开发者ID:jimaobian,项目名称:MarlinForOverlord,代码行数:46,


示例16: strlen_P

void ELClientMqtt::subscribe(const __FlashStringHelper* topic, uint8_t qos) {  uint16_t crc;  crc = _elc->Request(CMD_MQTT_SUBSCRIBE, 0, 0, 3);  crc = _elc->Request(crc, (uint8_t*)&remote_instance, 4);  crc = _elc->Request(crc, topic, strlen_P((const char*)topic));  crc = _elc->Request(crc, (uint8_t*)&qos, 1);  _elc->Request(crc);}
开发者ID:kaaLabs15,项目名称:el-client,代码行数:8,


示例17: fill_buf

unsigned short fill_buf(void* blk){	uint16_t webpage_len;	char int_string[4];	webpage_len = (strlen_P(webpage)>uip_mss())?uip_mss():strlen_P(webpage);	xSerialPrintf_P(PSTR("fill_buf : %s/r/n"), webpage);	memcpy_P(uip_appdata, webpage, webpage_len);	sprintf(int_string, "%X", mfg_id[0]);	memcpy(&uip_appdata[104], int_string, 2);	sprintf(int_string, "%X", mfg_id[1]);	memcpy(&uip_appdata[108], int_string, 2);	return webpage_len;}
开发者ID:UNIVERSAL-IT-SYSTEMS,项目名称:avrfreertos,代码行数:17,


示例18: setColorIndex

	void GuiPainter::box(const char* text, ArrowType_t arrow)	{		uint8_t save_color_index = m_impl.getColorIndex();		//Print box		setColorIndex(1);		m_impl.drawBox(0, ((screen_height - 1) - (box_height - 1)), box_width, box_height);		//Set font and color		setFont(FontType_t::BODY_FONT);		setColorIndex(0);		//Print arrows		switch (arrow)		{			case LEFT:				setPrintPos(2, ((screen_height - 1) - (max_font_height - 1)));				print("<");				break;			case RIGHT:				setPrintPos(((screen_width - 1) - 2 - (max_font_width - 1)), ((screen_height - 1) - (max_font_height - 1)));				print(">");				break;			case BOTH:				setPrintPos(2, ((screen_height - 1) - (max_font_height - 1)));				print("<");				setPrintPos(((screen_width - 1) - 2 - (max_font_width - 1)), ((screen_height - 1) - (max_font_height - 1)));				print(">");				break;			case NONE:				break;		}		//Print text label		if ( (text != NULL) && (strlen_P(text) > 0) )		{			setPrintPos( (screen_width - strlen_P(text) * max_font_width) / 2, ((screen_height - 1) - (max_font_height - 1)));			print_P(text);		}		coordinateYEnd(51);		setColorIndex(save_color_index);	}
开发者ID:ReeceGrim,项目名称:Marlin,代码行数:46,


示例19: Message

 Publish::Publish(String topic, const __FlashStringHelper* payload) :   Message(PUBLISH),   _topic(topic),   _payload_len(strlen_P((PGM_P)payload)), _payload(new uint8_t[_payload_len + 1]),   _payload_mine(true) {   strncpy((char*)_payload, (PGM_P)payload, _payload_len); }
开发者ID:AydinAdn,项目名称:pubsubclient,代码行数:8,


示例20: vDeviceTestTxHello

voidvDeviceTestTxHello (void) {  xTxLen = strlen_P (pcHelloWorld) + 1;  memcpy_P (ucBuffer, pcHelloWorld, xTxLen);  printf_P (PSTR ("Test de transmission %s/n"), ucBuffer);  prvvDeviceTestTx ();}
开发者ID:epsilonrt,项目名称:avrio,代码行数:8,


示例21: strlen_P

void PusherClient::getPusherInfoItem(int index, String& text){	char* ptr = (char*)pgm_read_word(&(pusherInfos[index]));	int len = strlen_P(ptr);	char buffer[len+1];	strcpy_P(buffer, ptr);	text = buffer;}
开发者ID:archerdragon57,项目名称:ArduinoPusherClient,代码行数:8,


示例22: OSC_effectiveStringLength

int OSC_effectiveStringLength(char PROGMEM *string) {    int len = strlen_P(string) + 1;  /* We need space for the null char. */        /* Round up len to next multiple of STRING_ALIGN_PAD to account for alignment padding */    if ((len % STRING_ALIGN_PAD) != 0) {        len += STRING_ALIGN_PAD - (len % STRING_ALIGN_PAD);    }    return len;}
开发者ID:BackupTheBerlios,项目名称:arduino-svn,代码行数:9,


示例23: strlen_P

extern "C" char *strncpy_P(char * dest, size_t max_len, const char * src_P){	int len = strlen_P(src_P);	if(len >= max_len)		len = max_len-1;	memcpy_P(dest, src_P, len);	dest[len] = 0;	return dest;}
开发者ID:blinkingnoise,项目名称:Sming,代码行数:9,


示例24: strlen_P

String & String::append(const __FlashStringHelper *pgmstr){	unsigned int length = strlen_P((const char PROGMEM *)pgmstr);	unsigned int newlen = len + length;	if (length == 0 || !reserve(newlen)) return *this;	strcpy_P(buffer + len, (const char PROGMEM *)pgmstr);	len = newlen;	return *this;}
开发者ID:ArtemAnchugov,项目名称:ATTinyCore,代码行数:9,


示例25: CDC_Device_SendString_P

uint8_t CDC_Device_SendString_P(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,                              const char* const String){	if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))	  return ENDPOINT_RWSTREAM_DeviceDisconnected;	Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address);	return Endpoint_Write_PStream_LE(String, strlen_P(String), NULL);}
开发者ID:tewarid,项目名称:ArduinoUnoUsbDfu,代码行数:9,


示例26: strlen_P

void Devices::flash_println(Stream* stream, const prog_char *ptr){	int32_t len = strlen_P((char*)ptr);//	char buf[len];//	strcpy_P(buf, (char*)ptr);//	stream->println(buf);	Devices::flash_print(stream, ptr);	stream->println();}
开发者ID:nigelb,项目名称:WaterQualityMonitor,代码行数:9,


示例27: testVerify_P

//------------------------------------------------------------------------------void testVerify_P(char* result, PGM_P expect) {  testOut->write('"');  testOut->print(result);  testOut->print("/",/"");  print_P(testOut, expect);  testOut->write('"');  uint8_t n = strlen(result) + strlen_P(expect) + 5;  testResult(!strcmp_P(result, expect), n);}
开发者ID:Akrobate,项目名称:sketchbook,代码行数:10,


示例28: strlen_P

//------------------------------------------------------------------------------void ostream::putPgm(const pgm &arg) {  char *str = arg.ptr;  int n = strlen_P(str);  fill_not_left(n);  for (uint8_t c; (c = pgm_read_byte(str)); str++) {    putch(c);  }  do_fill(n);}
开发者ID:Giuseppe33,项目名称:Arduino-Sketchbook,代码行数:10,


示例29: strcpy_P

/** * Adds the input PROGMEM string reference to linebuffer (if it has space for it) */void BMDSmartViewClient::_addToLineBuffer_P(const char *str) {	// PROGMEM pointer	if (_linebufferPointer+strlen_P(str)<BMDSmartViewClient_BUFFERSIZE)	{		strcpy_P(_linebuffer+_linebufferPointer, str);		_linebufferPointer+=strlen_P(str);	} else Serial.println(F("_addToLineBuffer_P ERROR"));/*  uint8_t val;  while (true) {    val = pgm_read_byte(str);    if (!val) break;	if (_linebufferPointer<BMDSmartViewClient_BUFFERSIZE-1)	{		_linebuffer[_linebufferPointer] = val;		_linebufferPointer++;	}    str++;  }*/}
开发者ID:kasperskaarhoj,项目名称:BMDSmartViewClient-Arduino-Library,代码行数:21,


示例30: strlen_P

MenuItemStruct::MenuItemStruct(PGM_P key_pstr, PGM_P help_pstr,		Menu * submenu_ptr, MenuCommand_Callback cmd_ptr){	key = key_pstr;	help = help_pstr;	subMenu = submenu_ptr;	command = cmd_ptr;	key_size = strlen_P(key);}
开发者ID:psychogenic,项目名称:SerialUI,代码行数:9,



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


C++ strlimcpy函数代码示例
C++ strlenW函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。