Category "c++"

Where do calendar messages in PST files store appointment times and dates?

I am using the PST File Format SDK to try and extract some appointment item data from an Outlook PST export: int main() { pst myfile(L"export.pst"); fo

How to implement C++ (in)equality operators for aggregate structs?

Sometimes I have structs such as this -- struct aggregate1 { std::string name; std::vector<ValueT> options; size_t foobar; // ... }; -- where (

How to create QT Window and use pure OpenGL core profile inside?

I don't want to use QOpenGLWidget, because of the old version of OpenGL inside. I don't understand what is the difference between getting QOpengGLFunctions from

Qt 5.1.1 compiler setup on Ubuntu

First of all, I should point out that I've never used linux before. I have a clean install of 64bit ubuntu, I downloaded Qt 5.1.1 for linux 64 bit from http://

How do I use a custom deleter with a std::unique_ptr member?

I have a class with a unique_ptr member. class Foo { private: std::unique_ptr<Bar> bar; ... }; The Bar is a third party class that has a create

C++ namespace "std" has no member "format" despite #include <format>

I am new to C++. I am trying to store the current date and time as a string variable. At this question, I found an answer, and installed the date.h library. How

How does `gdb` compute the bounds of a stack frame?

I am debugging a new thread library, in which I set the stack register rsp manually (to switch to a user-managed stack), and then invoke a function which never

C++ Double Address Operator? (&&)

I'm reading STL source code and I have no idea what && address operator is supposed to do. Here is a code example from stl_vector.h: vector& operat

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