daily_automated
This commit is contained in:
16
trunk/Arduino/esp32-cam-webserver/src/parsebytes.cpp
Normal file
16
trunk/Arduino/esp32-cam-webserver/src/parsebytes.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* From https://stackoverflow.com/a/35236734
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
void parseBytes(const char* str, char sep, byte* bytes, int maxBytes, int base) {
|
||||
for (int i = 0; i < maxBytes; i++) {
|
||||
bytes[i] = strtoul(str, NULL, base); // Convert byte
|
||||
str = strchr(str, sep); // Find next separator
|
||||
if (str == NULL || *str == '\0') {
|
||||
break; // No more separators, exit
|
||||
}
|
||||
str++; // Point to next character after separator
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user