Sending structs over serial connection C++

I am exchanging structs over serial connection, in C++, between my linux machine (x64) and a micro controller (Arduino Uno). The struct is basically as follows for now. struct __attribute__ ((packed)) packet { uint8_t data[12]; } For numbers s...
more »

2017-09-11 16:09 (0) Answers

"Empty" array\vector members c++

I have to fill an array of 1000 objects by reading data from disk. However, not every objects exits. Once I declare an array, memory will be reserved for 1000 objects. As I read them one by one, I set the memory to corresponding values. However, the...
more »

2017-09-09 20:09 (3) Answers

C++ DLL function used in Delphi7

I want to use c++ DLL in my delphi 7 project.I have successfully call one function of DLL in my delphi7 project but getting error in another function in which parameter is stringbuilder. C++ function detail is as follow.(which i got from header file...
more »

2017-09-09 12:09 (2) Answers

.h file crossed out and grayed out in eclipse

I'm using a project created by someone else and several pre-existing files are grayed out and crossed out in my project explorer. This question tells how to handle the .c files but the option does not work for the .h files: What would cause my sourc...
more »

2017-09-08 23:09 (1) Answers

Make doxygen skip anonymous enums by default

I'm using doxygen to document a C++ project. I want doxygen to include my named enums, enum foo { ... };, in the documentation (regardless of whether I've documented them with a doxygen comment), but to skip unnamed, enums, enum { ... }; Can this ...
more »

2017-09-08 12:09 (0) Answers

building API documentation / getting started

I have only recently had a look at the movesense device-lib; planning to build a custom firmware for the sensor. I have managed to set-up the build-environment under OS X but now am desperately looking for documentation. How can I produce a readabl...
more »

2017-09-07 18:09 (0) Answers

find() with regex in C++

I am trying to parse a text file using C++ and check whether there a specific PATTERN exists or not. The PATTERN consists of ;<n_WhiteSpaces><MACRO>. In my code, these MACROs are already defined in a C++ Vector and we are using an itera...
more »

2017-09-04 21:09 (1) Answers

node-gyp - not finding library headers

I'm trying to use a the gstreamer framework in my node addon. I had the following to my to my binding.gyp, but when i run the build command it, the console states that the header is not found. When i compile my gstreamer files outside of node-gyp, it...
more »

2017-09-03 21:09 (1) Answers

Need help for converting an integer to binary

Im new to C++ and I need to make a program that can convert a decimal number into a binary one. This is what ive got so far, but it only shows 0000 0000 0000 0000 (the spaces are intended) #include <stdio.h> #include <iostream> #include ...
more »

2017-09-01 21:09 (1) Answers

fastest way to find an integer in a dataset

The interview question is more complicated, so i simplified it as input data will be in a format of A,B A is a number between 0 and 18446744073709551615(mysql bigint) B is a random string we will provide IO part You should provide two functions ...
more »

2017-09-01 07:09 (2) Answers

initialize std::array with 'this' pointer

I am trying to initialize an array inside a template class and pass the this pointer to all elements in the array. This is what my classes might look like: template<int NUM> class outer_class; template<int N> class inner_class { pr...
more »

2017-08-29 16:08 (2) Answers

Why was getenv standardised but not setenv?

From answers and comments on this question, I understand that getenv is defined by the C++ standard, but setenv is not. And indeed, the following program #include <cstdlib> #include <iostream> int main ( int argc, char **argv ) { st...
more »

2017-08-29 13:08 (2) Answers

being sure about "unknown evaluation order"

Since version 1.80, Cppcheck tells me that Expression 'msg[ipos++]=checksum(&msg[1],ipos-1)' depends on order of evaluation of side effects in this code sequence (simplified, data is a variable) BYTE msg[MAX_MSG_SIZE]; // msg can be small...
more »

2017-08-29 13:08 (2) Answers