Category : expression

I wanto to use sscanf to extrat the 2 first integer (5 and 10) in a string rssi = 5 ber = 10 like this : #include <stdio.h> #include <iostream> #include <string> using namespace std; int main() { std::string str = "rn+CSQ: 5,10rnrnOKrn7556rn"; unsigned char lBufRX[100]; char *rssi, *ber; if((sscanf(str.c_str(), "%*[^:]: %s,%s[^n]", rssi, ber)) != ..

Read more

Imagine I have this template class. template <typename… TMessageHandler> class message_handler_set { public: static bool call_handler(const MessageType& command) { // Call each TMessageHandler type’s ‘call_handler’ and return the OR of the returns. } }; I would like to be able to call the static call_handler for each of the TMessageHandler types and return the OR ..

Read more

I’m currently working on a project where I’ve got stuck due to "out of range", "memory access violation" and other similar issues. Having spent much time trying to figure out where the problems come from, I came to a trivial piece of code like this: #include <iostream> #define RANDOM(min, max) min + RAND_MAX / ((RAND_MAX ..

Read more

I want to split the following mathematical expression -1+33+4.4+sin(3)-2-x^2 into tokens using regex. I use the following site to test my regex expression link, this says that nothing wrong. When I implement the regex into my C++, throwing the following error Invalid special open parenthesis I looked for the solution and I find the following ..

Read more