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; ...
Feb 25, 2023 at 10:30pm
[5 replies] Last: It means that C++ standard doesn't say what type should be returned f... (by deleted account xyzzy)
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...
Feb 25, 2023 at 5:59pm
[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...
Feb 24, 2023 at 1:57pm
[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...
Feb 24, 2023 at 10:37am
[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...
Feb 23, 2023 at 5:45am
[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 ...
Feb 21, 2023 at 5:04pm
[6 replies] Last: I don't have the knowledge to Poke around that source One of the bes... (by deleted account xyzzy)
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 ...
Feb 20, 2023 at 5:52am
[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
Feb 17, 2023 at 11:45pm
[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...
Feb 17, 2023 at 5:49pm
[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
Feb 16, 2023 at 10:08pm
[3 replies] Last: I don't know QT, but with Visual Studio and Code::Blocks there's an ou... (by deleted account xyzzy)
by jNc
How to create object of class using char variable
class Test {} char const * objectName = "Test"; Test("objectName"); Please advise
Feb 16, 2023 at 8:06pm
[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() { ...
Feb 14, 2023 at 12:57pm
[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 ) ); ...
Feb 13, 2023 at 3:56pm
[4 replies] Last: A good C++ compiler will consume C code without too much problem, reco... (by deleted account xyzzy)
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...
Feb 13, 2023 at 1:49pm
[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...
Feb 12, 2023 at 11:51pm
[14 replies] Last: Since I want to learn C++, I am trying to convert all the C-code from... (by deleted account xyzzy)
is it correct to use continue too skip some loop conditions?
or there other way
Feb 8, 2023 at 11:41am
[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...
Feb 8, 2023 at 11:32am
[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...
Feb 8, 2023 at 5:30am
[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
Feb 7, 2023 at 5:00pm
[4 replies] Last: Since the OP mentioned Windows here's an older Win-centric header-only... (by deleted account xyzzy)
by jNc
how to declare array in Constructor
Never met this task before, but how to declare array in Constructor?
Feb 7, 2023 at 1:33pm
[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.
Registered users can post in this forum.