Category "c++"

Generate HMAC SHA256 hash using key in C++

I am looking for some function or a way that would return HMAC SHA256 hash in C++ using secret key. I have seen documentation of Crypto++ and OpenSSL but it doe

What are the basic rules and idioms for operator overloading?

Note: The answers were given in a specific order, but since many users sort answers according to votes, rather than the time they were given, here's an index of

Determining if a number is prime

I have perused a lot of code on this topic, but most of them produce the numbers that are prime all the way up to the input number. However, I need code which

How to implement Pub-Sub Network with a Proxy by using XPUB and XSUB in ZeroMQ(C++)?

I am a newcomer to zeromq. Recently I did some tests on pub/sub of zeromq, and I don't konw how to implement Pub-Sub Network with a Proxy by using XPUB and XSUB

Displaying FPS in GLFW window title?

Im trying to get my FPS to display in the window title but my program is just not having it. my FPS code void showFPS() { // Measure speed doubl

"[ilink32] Fatal: Out of memory" in C++ Builder

After updating Embarcadero C++ Builder to a new version, our project suddenly fails to build. This happens just with one of our projects. For the most of the te

c++ undefined reference to vtable

I'm learning C++. I'm trying to do an exercise where I define several implementations of a pure virtual class with a single function. I'm having trouble linking

Is an "if(...) return ...;" without "else" considered good style? [closed]

This code: if( someCondition ) return doSomething(); return doSomethingElse(); versus this code: if( someCondition ) return doSom

Embedding resources in executable using GCC

I'm looking for a way to easily embed any external binary data in a C/C++ application compiled by GCC. A good example of what I'd like to do is handling shader

Setting mouse position?

Well I'm working on a small program and I'm trying to set the position of the window's mouse to it's center every time it moves. Thing is I have no idea how to

Performance of Win32 memory mapped files vs. CRT fopen/fread

I need to read (scan) a file sequentially and process its content. File size can be anything from very small (some KB) to very large (some GB). I tried two tec

Set the digits after decimal point

I have a float number for example 12.12123 Is there a function which would display only number with 2 digits after decimal point 12.12 ? Here is the code: y1

I'm having trouble putting who wins in my game

So everything in my code works so far, but I don't know why the checkWinner function doesn't work. In my Bool checkWinner function, I used bool. When I call th

convert an int to QByteArray in Qt

I'm trying to convert an int to QByteArray. I'm using this method QByteArray::number(m_vman); is it correct? I'm trying to use the number() for getting an int t

invalid fastbin entry (free)

I am trying to find the cause for: *** glibc detected *** ...: invalid fastbin entry (free): 0x00007fc384ced120 *** The program dumped core, so I was able to

Excel RTD (Real Time Data) client other than Excel?

I have been looking all over, and couldn't find any example for an RTD CLIENT (many RTD server samples, though). My goal is to 'pull' data from an RTD server i

clang-format for Eigen matrix initialization

To inialize for example Eigen::Matrix3i we can use syntax: Eigen::Matrix3i T; T << 1, 0, 0, 0, 2, 0, 0, 0, 3; However, when using clang-forma

I failed to compile C++ code on Visual Studio Code

I'm using "glut" library and trying to compile code by gcc compiler, but it gives undesireble result. When I try to build command (Ctrl+Shift+B) on Visual Studi

Exact difference between rvalue and lvalue

While I was reading http://thbecker.net/articles/rvalue_references/section_01.html, I got following snippiest. // lvalues: // int i = 42; i = 43; // ok, i is an

How to put what the user picks for the row and column in the board

So my question is how do I put what the user enters, for example, they put row : 1 and column: 2 in my board that I made. I'm working on this in the void player