c%2b%2b's questions - English 1answer

571.021 c%2b%2b questions.

Sample code: struct S { int x; }; int func() { S s{2}; return (int &)s; // Equivalent to *reinterpret_cast<int *>(&s) } I believe this is common and considered acceptable....

My application has a class "MyClass". It's objects are being constructed from the Boost Object_pool. I need to serialized/de serialize this class object via Boost Binary Serialization. For ...

Have simple application for testing QMetaObject::invokeMethod purpose : #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(...

I have to process a .PNG file. The processing takes an std::vector as input and I would like to show the images as grayscale. So what I did: Mat img = imread("Image.PNG"); cvtColor(img, img, ...

I am desperately trying to get some nacl encryption (from https://nacl.cr.yp.to/index.html) going (in c/++). More specifically I want some public key sign, but unfortunately I could not even include ...

I am working on a library which uses a struct which should have the default constructor accessible by users of the lib. struct Example { Example(int x); private: Example(); }; Inside the ...

My requirement is to multiply rational fractions using classes then implement a standalone(nonclass) function void printRationalAsFloating(const Rational &r) using friend function for printing the ...

Update: Fixed. Very simple solution. I just have to add in my Add_Executable method. Here: add_executable (POC eb_pms.cpp url_binder.cpp) So this problem looks pretty small, yet, I am unable to find ...

Playing with QMetaObject::invokeMethod method : #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ...

The purpose is to find any new/modified/deleted files. 00tobedeleted is the folder i created in C:\Windows\System32. When im running following command via CMD: dir C:\Windows\System32\00tobedeleted /...

Salutations fellow programmers, I am trying to write a program that allows you input what you want and the program will send your input to the server. At the moment, my goal is sending HTTP requests ...

I have a tree which is used to store values of different types, e.g. int, double, string or whatever. There is a Base class which implements the basic tree functionality (children, parents) and a ...

does anyone have experience in Unicodes? I am facing a tough problem with Farsi unicodes. I have an std::wstring s = (L"\u0634\u0646\u0628\u0647"); which is a Farsi word. When I debug it, I see that ...

I'm having troubles understanding a Valgrind error displayed compiling a C++ program to create and manage a 3D array. I coded the software on my Mac, and everything looked fine, but when I ported it ...

I have a doubt about a question I often ask myself, this is the situation: Two classes, no virtual destructor class Base { int myInt; }; class Derived : public Base { int myIntDerived; }; ...

I want to virtualise and duplicate an application which I've developed in C++ on Qt (Windows with Qt 5.9.1). The application is already developed and I want to duplicate it 20 times. Note: each ...

I've been looking for some time for a way to send JSON over a tcp socket and to de-serialize it into an object. The problem that I'm having is that when my message is too big, TCP chunks it. By doing ...

I have a Windows program which has two 2 windows in it: hwnd (main interface) hwnd2 (toplevel window, no parent, created by hwnd) When I double click on hwnd, I need hwnd2 to pop up and show some ...

I saw, that there are libraries, that offer data types like BigInterger, but I need one, that contains a variable type, that is "big" (means: that can handle very high values) but also I need the ...

I have to work with scripts that puke scary amounts of prints so I grep 50% out, merge some lines that reduces another 30% and color the remaining 20% for easier reading... but the coloring seems like ...

We are trying to compute the Schur complement for a large symmetric positive definite matrix H composed of diagonal blocks U and V and offset diagonal blocks W and W' (tranpose of W), and V is a ...

I have been following the instructions in the OpenSSL User Guide, which links to a guide by 3noch for compiling OpenSSL. Here are the tools/versions I am using: ActiveState Perl v5.20.2 Microsoft ...

After a long troubleshooting, I managed to make my small test program work with Qt Creator (from what I've seen, several people got troubles for that). I'm sharing here a solution (see my answer), ...

During a gdb session, the debugged remote application dynamically loads up a shared library, which contains a reference to a separate debug file. A breakpoint is set in the source code that produced ...

I am unexpectedly getting a very low FPS (~16 fps) while capturing from the internal webcam (1280x720 @ 30fps) of a recent Dell XPS 9560. This is the trivial code I'm using ( python3, OpenCV 3.4.0 ) ...

So I wanted to do some home automation, so I assigned an esp8266 to each of the rooms of my house, all of them are connected to a single wifi as clients with static ip addresses, so I can control my ...

Creating files in C++

4 answers, 159.773 views c++ file-io
I want to create a file using C++, but I have no idea how to do it. For example I want to create a text file named Hello.txt. Can anyone help me?

I'm looking for the faster method to extract the map values filtered by vector keys. Below the standard code: std::unordered_map<uint32, user> map; std::vector<uint32> to_find; ...

I have been studying addition of rvalue reference in C++11. It wasn't straightforward but I feel like I am finally starting to get a grasp of it. However there is one particular instance where I am ...

I'd like to use constexpr versions of standard <cmath> functions like exp, log, pow in a portable way. I currently have a non-portable solution g++ treats these functions as constexpr - a non-...

I am having an extremely annoying problem with my code which is supposed to read a binary file and encrypt each bytes in XTEA following a certain pair of keys. I already have an encrypted payload ...

I have two installations that I'm developing and testing on, one of the systems is: 64 bit Windows 7, running MSVC 2010 The other is: x86 Windows 10, running MSVC 2005 I have the exact same code ...

I compiled and installed openCV 2.4.2 in ubuntu 12.04. Under /usr/local/include I can see the directories /usr/local/opencv and /usr/local/opencv2. Here is the code I wrote: #include <cv.h> #...

user@pc ~/hiddensymbols % cat main.cpp __attribute__((visibility ("hidden"))) int f_b1(void){ return 21 ; } __attribute__((visibility ("hidden"))) int f_b3(void){ return f_b1() ; } ...

I am using PowerPoint2010 c++ automation,in visual c++ 2010. The GradientStops,it is a object in Office.You can check this. I want the C++ automation interfaces for the GradientStops Object, but I ...

I'm trying to create a 2D texture, but I can't change its size (width and height). bool Character::Initialize(ID3D11Device* p_device, FT_GlyphSlot p_glyph, char p_character) { HRESULT result; ...

When trying to create a folder in a mapped network drive with boost filesystem create_directories function, I get random errors of type: "The system cannot find the path specified.". By random I mean ...

I've got a problem with compiling the following files. Just to explain the situation: I did get all of the files, except the Makefile, for an exercise. My problem is, that I can not compile the ...

I have the following proto file package DS3DExcite.Cpp.ExternalVariantSwitcher.ProtocolBuffers; message DGCommand { extensions 100 to max; enum Type { AttachModel = 1; ...

We have customers asking for VBScript functions to be called when particular actions occur within our product. I've been trying to research the Windows Scripting technologies but I'm having difficulty ...

I'm writing a react native application that is bridged with cross platform C++ code that produces images. I'd like to send a container component from React Native to the C++ code to display the image ...

I am making a simple game to help me learn basic c++ code. I want to make a zombie able to follow / chase the player in a 2d snake-like environment. Though I haven't been able to find a way to get ...

I've developed a c++ project with visual studio 2015. The output of my project is a single executable that must have a unique ID for every client and this ID must be accessible inside the code. A ...

I'am use ArCore with Android NDK. And I want to recognize square from each frame of ArFrame. I'am successfully get ArImage throught ArFrame_acquireCameraImage(...) and convert it to AImage throught ...

I'm currently working on a GUI app that is supposed to decrypt some data and print it on the screen, on Windows and Qt (C++) based. The code works fine and I now have to distribute it. However, the ...

I have a rather convoluted CMake project that I'm editing in Qt Creator. It compiles fine, but the Clang code model can't find some headers. It's not a bug - it's just because of how I am abusing ...

I am quite newbie in C++ and have always written codes into one file. However, last time I have been making bigger project, so I have created few .cpp and header files and a program works fine. Except ...

Lets say I have a class Vector In this class I have a method to calculate the norm of a vector. Vector a double Norm = a.norm() I would like to use MPI to distribute this calculation. This is a ...

I am using 64 bit Windows 7 OS. I have installed 32 bit Flex and Bison from Sourceforge as per the following instructions: http://www.surajgaikwad.com/2013/10/compile-lex-and-yacc-progs-on-windows....

I'm working on a project to improve my skill in OpenCV and since I'm new, I lack a lot of knowledge. In my project, I've detected faces on images, cropped the face area, converted it to grayscale, ...

Related tags

Hot questions

Language

Popular Tags