General C++ Programming - January 2022 (Page 2)

by frek
Casts
 
In this code-snipped class B { public: virtual void Test(){} }; class D : public B { void Test(); void print(std:: string st) { std::cout<<st<<'\n; }; void ...
[2 replies] Last: One should also ask if the use of a cast is necessary: it may not be, ... (by TheIdeasMan)
by Cplusc
map
 
hello I have two vectors, a {1,4,8,3,6,9} and b{ 0,1,2,3,4,5}. For accessing the 5th element inside vector a, instead of a I want to use b which corresponds ...
[4 replies] Last: Thanks for your answer. Actually I thought about this as well, but I'm... (by Cplusc)
by frek
Pointers to classes and casts
 
Here: class B { public: virtual void Test(){} }; class D : public B {}; void f(B* pb) { D* pd1 = dynamic_cast<D*>(pb); D* pd2 = static_cast<D*>(pb);...
[12 replies] Last: Thank you. I try to form a new thread for the latter question to get t... (by frek)
Help with multi dimensional arrays!
 
Hello! Could come help me get started with this program? Write a program using a multi-dimensional array that allows the user to enter payroll data for a bus...
[4 replies] Last: I have been trying to start this assignment for a bit, and just cant ... (by seeplus)
encrypt and decrypt pointer
 
Hello , How to encrypt and decrypt pointer [ 99DE27 ] And save the result in ini file
[18 replies] Last: Thank you all for your help Thank you Ganado (by Hawlong)
by frek
Get started learning Embedded programming in C++
 
Gus, I have a general question about embedded. I'm a C++ programmer and would like to start learning embedded programming using C++. I've searched much to find ...
[1 reply] : While I haven't toyed with arduino or anything smaller than a raspi, I... (by newbieg)
Can Someone Help Me Find Error in This Program?
 
<edit>OP deleted their post and ran away. USAFrenzy rescued the mess and it's posted below in message https://www.cplusplus.com/forum/general/281826/#msg121957...
[9 replies] Last: I'm impressed that you found it. Thanks. I chose a distinctive look... (by mbozzi)
Can someone explain me this unexpected output?
 
I was trying to handle different line-ending. But as I expected the output was different than expected. test4utf8mac.srt is a subtitle file of SubRip format h...
[3 replies] Last: You could evaluate this at compile time without "macro-fying" things b... (by USAFrenzy)
How to read file having different line ending in Cpp
 
I have two files "linuxUTF8.srt" and "macANSI.srt". I am reading these files using getline(). as macANSI.srt has '\r' as line ending I am reading the whole file...
[5 replies] Last: Read the whole file into a string. Then find the first occurrence in t... (by seeplus)
how convert GDIplus::color to colorref?
 
how convert GDIplus::color to colorref? point Point=PixelLine ; Color *color; img->GetPixel(PosY,PosX,color); ...
[2 replies] Last: thank you so much for all.. works fine (by Cambalinho)
string handling
 
I am trying to resolve the below string manipulation. But code doesn't work as expected. Need help with some inputs. Input First line of input contains string...
[8 replies] Last: Right! I don’t know what I was thinking – I was probably already s... (by Enoizat)
How to capture the screen of a window that contains transparency?
 
Cross-posted https://docs.microsoft.com/en-us/answers/questions/702376/how-to-capture-the-screen-of-a-window-that-contain.html https://stackoverflow.com/questio...
[1 reply] : Also asked and answer given at https://forums.codeguru.com/showthread.... (by seeplus)
GDIPLUS: using Graphics, can i get HDC?
 
using Graphics, can i get HDC?
[15 replies] Last: Yes, I would think that BitBlt(...) is only reliable within the paint ... (by coder777)
Issues regarding Menu
 
Hello, I have to make a menu, 1. compress Text that will give allow you to input a value that will appear in 2. Extract Text. The problem is that it outputs th...
[12 replies] Last: what I would do is get a statistical breakdown of english and assign t... (by jonnin)
by frek
General rule on inheritance
 
Will you please explain this general rule: “a D is a B” does not imply “a Container<D> is a Container<B>” with some simple example to be easily unders...
[12 replies] Last: Thanks for your time. patience, and help. :) (by frek)
temporary objects get destroyed and corrupt program
 
I believe the following code has a bug related to temporary objects getting destroyed leaving dangling references... however I don't know how to find this in th...
[4 replies] Last: That's it!! Not quite. Having references as member variables are alwa... (by coder777)
iterating over a static std::vector
 
So I have a static std::vector like this: static std::vector<ApiWrapper> api_handlers = { Rtl::RtlDuplicateUnicodeString, Rtl::RtlInitUnicodeString, ...
[8 replies] Last: Could be SIOF https://en.cppreference.com/w/cpp/language/siof (by mbozzi)
Assignment operator bottlenecking simulation
 
I am running a Monte Carlo simulation of a polymer. The entire configuration of the current state of the system is given by the object called Grid . This is my...
[15 replies] Last: maybe instead of G = std::move(G_), the easiest thing to do might be ... (by seeplus)
by frek
Change C code to C++ in an embedded project
 
The following C code is in the main.c file of an embedded project on STM32CubeIDE. /* USER CODE END Header */ /* Includes --------------------------------...
[9 replies] Last: Thank you very much salem c . Your remark is right and worked. First... (by frek)
For Loops in an Array Comprehension Help
 
Hi guys, I encountered this problem while I was tackling loops in an array. Can someone help me by explaining to me how do I get the number 1 in the output? Bec...
[1 reply] : So without the 2nd a++ at line 21, you do understand why you see 1 ... (by salem c)
January 2022 Pages: 1234
  Archived months: [dec2021] [feb2022]

This is an archived page. To post a new message, go to the current page.