Beginners - January 2023

Reading unkown number of bytes from a non-blocking socket (1,2)
Hi, I am trying to learn C++ and my first project is to convert a Basex Client I wrote in R to a C++ client. From the earlier experiences, I know that I hav...
[20 replies] Last: You can pass in the timeout as a parameter. You should be able to modi... (by kbw)
is this ok as a less than operator for a map?
I have a map of the following type: struct MyType { size_t layerPos, posInLayer, prevPos; }; std::map<MyType, string> myMap; std:...
[3 replies] Last: struct MyType { std::size_t layerPos = 0 ; std::size_t posInL... (by JLBorges)
keep getting error
keep getting an error, not sure what im doing wrong. I'm running it on visual studio Microsoft. The main errors I'm getting is "argument of type "const char *" ...
[12 replies] Last: > violating a suggested guideline It is a rule; not a mere guideline ... (by JLBorges)
by Ch1156
Should smart pointers be preferred over new and delete keywords?
Im on chapter 11.9 of learncpp and i see that its going to be teaching about using new and delete, but i heard its better to use smart pointers instead. I can u...
[2 replies] Last: At least do the basics. An hour or two of your time will help a lot w... (by jonnin)
by Mif
length of the array of pointers, using strlen in C
Hello.. How do I find the length of this array of pointers? char *gCreditsEn = { "Title", "Game created by:", "Game Design:", "Music by:", "...
[16 replies] Last: Sure, but strlen expresses intent better. (by Ganado)
by anup30
print the content of your program's source file to console, without user inputting the file name or giving it in source.
print the content of your program's source file to console, without user inputting the file name or giving it in source. the main problem here is getting the...
[11 replies] Last: If it had ^^ instead of ^^^ teeth I would a vampire but I hope JLBorge... (by malibor)
Why is cin not working after loop?
Hi everyone! so I have an issue I cannot figure out, basically when I simulate eof using ctrl + d the second use of cin is never used and skipped over, I have a...
[3 replies] Last: Thanks seeplus for the help with this! I really like the idea of using... (by Dakiller)
Be careful when storing the result of std::clamp as a reference
Earlier, someone posted a question about std::clamp but the thread was removed before I had a chance to respond (probably because the OP realized his mistake). ...
[12 replies] Last: Some structs are PODs. (by Peter87)
Stack frame error
Hi. I ask couple of days ago about unexplained code behavior. It hasn't been solved completely. I now have some more specific details about that. Function In...
[15 replies] Last: Hi folks. I have an update about the issue. in sitalDevice_Initialize... (by Jonathan100)
Was std::set suppose to model mathematical sets?
I apologize in advance. This reads like a half-rant/half-question trying to understand why C++ was designed a certain way. std::set seems redundant and beha...
[5 replies] Last: It depends on your perspective, I suppose. in short to the above, no... (by jonnin)
Looking for guidance on writing desktop apps
Hi People, I want to write some desktop apps. I have some good ideas. However, I have become very aggravated with current book offerings. I have 2 books on C++....
[11 replies] Last: > I also do not have a problem with learning C# and .net. >> I would ... (by JLBorges)
Finding Vector(includes objects) Element's Index by Element
I'm trying to find the index of a vector element. Vector includes class objects. But I can't find a way. #include <vector> #include <algorithm> #include...
[2 replies] Last: Perhaps this: #include <vector> #include <algorithm> #include <iost... (by seeplus)
Size of Union and Struct
Hello, I want to calculate the size of struct and union. Is the below true? In the union, the output is 20, I expected being 24 (20 is size and 4 for paddin...
[14 replies] Last: Worth noting that standard C++ has alignas for controlling alignment... (by mbozzi)
Inheritance and virtual functions
Greetings! I try to understand the role of the virtual keyword when changing the signature of a member function in a derived class compared to a base class (I ...
[9 replies] Last: Thank you guys! (by PhysicsIsFun)
Returning wrong value
Write your question here. In function Sum why is program returning an 8 in sizeof(A) instead of 4? Int*P points to first element in array A which is an inte...
[8 replies] Last: For typical values, std::ptrdiff_t can be used as signed std::size_... (by JLBorges)
by Ch1156
How to output a map from a class with operator overloading (1,2,3,4)
So im trying to output the contents of a map from the class and i obviously have to overload the << operator to do so but i cant seem to figure out what im dong...
[77 replies] Last: Yow, that there is one mouthful. (by George P)
How Can I Initialize this Dynamic array?
Hello, How Can I Initialize this Dynamic array? I'd like to have pointer to an array with size n int *arr #include<iostream> using namespace s...
[3 replies] Last: If you are wanting to have a dynamic array why bother with pointers, e... (by George P)
can i declare an iterator outside of the container class?
Hi I have created a container class for which I need to create a bespoke iterator (not merely exposing the iterator of the container's internal data type). ...
[1 reply] : > I find the container class becomes somewhat cluttered > as the decl... (by JLBorges)
by StMick
Cannot access vector[0] index
Hello! Any advice on the code below would be appreciated. I keep getting a segmentation fault stating "cannot access memory at address ..." where it is ...
[5 replies] Last: Consider (when v is sorted ascending): #include <vector> #include <... (by seeplus)
code unexplained behavior (1,2)
Hi guys. I work with some exotic hw design [microblaze + ddr], which upon I build sw which consists of many .cpp and .h files. At some point i encounter unexp...
[23 replies] Last: [quote=Peter87]Well, we do see that there are sitalMaximum_DEVICES num... (by lastchance)
January 2023 Pages: 12
  Archived months: [dec2022] [feb2023]

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