Beginners - February 2023

why does std::bind work here?
 
#include <iostream> #include <functional> #include <vector> int main() { using FType = std::function<int()>; std::vector<FType> funcs; ...
[5 replies] Last: It means that C++ standard doesn't say what type should be returned f... (by George P)
Multplexer 4x1 program
 
I am utterly lost, I am making a program based on a 4x1 multiplexer and output the truth table. But I am not sure how to go about it,this is the multiplexer htt...
[4 replies] Last: a very beginner friendly take on it: int mux(int a, int b, int c, in... (by jonnin)
Sharing socket between class instances
 
I have two classes: * BasexClient is used to manage all data between the client and an instance of BasexSocket * BasexSocket is used for communication with the...
[5 replies] Last: Dbuging and stepping through my code learned me that indeed there was ... (by Bengbers)
Algorithm review
 
Hey guys, I'm coming back to study cpp after few years of stopping. Tried to implement a sorting algorithm on std::vector, Kindly have a look at the solution...
[8 replies] Last: Using C23++ std::ranges::to so that the vector can be const (can't be ... (by seeplus)
by Fojaxx
Decode dtmf tones
 
Ok so right off the bat, its been 6 years or mord since i've dabbled with c++ and i was never more then a novice at it. Now i have an idea that i want to make a...
[1 reply] : You need to process an audio signal and detect two frequencies in the ... (by AbstractionAnon)
Download from Google Drive
 
Hi, I want to write a DLL to download a simple text file from Google drive. Could someone help me with this please? I can do it in a language called MQL but ...
[6 replies] Last: I don't have the knowledge to Poke around that source One of the bes... (by George P)
Overloaded Functions Returning Const & Non-Const Pair<>
 
MSVS 2022 17.4.5 (v143), /stdc++latest I'm experimenting with templates and const-ness. How do I ensure the correct function call to return a const? This is ...
[3 replies] Last: Thanks for the advice, both of you. mbozzi, that's it! My parenthese... (by SimpleCoder)
by jNc
Split cpp file, linked to one .h
 
have header.h and 0.cpp and 1.cpp, both include header.h, I create object in body of 0.cpp, but it is not visible in 1.cpp
[3 replies] Last: If you need information on why there's so much hate for global variabl... (by newbieg)
Reading from a non-blocking socket
 
In the thread https://cplusplus.com/forum/beginner/285198/ kbw(9472) presented the following function for reading from a socket: int readSocket( std::stri...
[14 replies] Last: One of the options in the Eclipse CDT debugger view is to display the ... (by Bengbers)
by jNc
how to get building time and compile time w cpp or w some api
 
need to get building time and compile time w cpp
[3 replies] Last: I don't know QT, but with Visual Studio and Code::Blocks there's an ou... (by George P)
by jNc
How to create object of class using char variable
 
class Test {} char const * objectName = "Test"; Test("objectName"); Please advise
[6 replies] Last: If you want to use strings to refer to objects you can use std::map (o... (by Peter87)
Can a base class function be overriden if it isn't declared virtual?
 
I wanted to verify something that was said in a youtube video. Code below is what was presented. class BaseClass1 { public: void function1() { ...
[2 replies] Last: Thanks JLBorges. That's new to me. (by ElusiveTau)
by jNc
How to use C code in C++
 
int *pi; pi = malloc( 25 * sizeof( int ) ); error: invalid conversion from 'void*' to 'int*' [-fpermissive] pi = malloc( 25 * sizeof( int ) ); ...
[4 replies] Last: A good C++ compiler will consume C code without too much problem, reco... (by George P)
Debug went crazy
 
Hi friends. I built some simple i2c protocol driver code to work with Xilinx. When I debug the code, something strange happens - the code run back and forth bet...
[1 reply] : Maybe Xil_In32 also needs to be declared as a volatile function. st... (by salem c)
What is send over the socket when sending std::string?
 
With help from DizzyDon and kbw (see https://cplusplus.com/forum/beginner/285198/), I have been able to create a non-blocking socket and read from it. I use thi...
[14 replies] Last: Since I want to learn C++, I am trying to convert all the C-code from... (by George P)
is it correct to use continue too skip some loop conditions?
 
or there other way
[2 replies] Last: With example: for/while/do ... { A; if ( condB ) continue; B... (by keskiverto)
by IanTG
Recursive
 
In this program, the main function will take the size of the array as input and create a dynamic array of that size. Users will enter the values of the array. P...
[13 replies] Last: @ IanTG : Could you explain how you got from A to B? A: [quote=IanT... (by keskiverto)
Is interpreting sensor value safer with unsigned?
 
I am currently working on spi sensor that spits out 16-bit two's complement system value, since I have signed 16-bit integer data type (sint16) which are also r...
[3 replies] Last: I have read the application details and it is signed 16-bit number in ... (by Happilicious)
How to color highlight text output in terminal (C++ and Windows)
 
Tried some notations, but they cover each other and look so dirty. kindly advise
[4 replies] Last: Since the OP mentioned Windows here's an older Win-centric header-only... (by George P)
by jNc
how to declare array in Constructor
 
Never met this task before, but how to declare array in Constructor?
[9 replies] Last: Yes. I used a struct for an example of a constructor for simplicity as... (by seeplus)
February 2023 Pages: 12
  Archived months: [jan2023] [mar2023]

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