General C++ Programming - December 2019 (Page 4)

by volang
"New" in front of members of object created with "new"
 
If I create an object using "new", is it still necessary to use "new" when creating a char array(within that object/class) that I want in heap? Best regards ...
[18 replies] Last: start simple: how much ram do you have, and is your compiler 64 bit or... (by jonnin)
Two blocking tasks on the same thread
 
Hello! Though I have several years of programming experience, I have little experience with C++. So, maybe this topic belongs in the beginner section. I'm fami...
[4 replies] Last: Thanks for sharing your thoughts. I completely agree that keeping it s... (by imposter)
DOUBLY LINK RANDOM NUMBER GENERATOR
 
How would I begin writing a function to fit these instructions? 1. Create an integer variable named ‘listSize’ and initialize the value to 1000. 2. Op...
[2 replies] Last: Step one: define listSize as 1000. This you can do super easy, you hav... (by highwayman)
How definitively to cast/remove 'constant' ?
 
How exactly is const_cast<> working which way is for which constant : int main (){ const char *s="foo bar"; char *sres; char const str = "b...
[12 replies] Last: I wouldn't rely on such behavior for a more complicated function. I w... (by jonnin)
C++ won’t print, even with cout::flush
 
Why doesn’t std::cout print? #include <iostream> using namespace std; int disassemble8080(int programCounter, unsigned char* codeBuffer) { short O...
[5 replies] Last: it unfortunately promotes it inside the code, so when it loads the CP... (by jonnin)
How i can learn to address particular issues in my software??
 
Hello. My name is Enrique. I am having issues in my source code. I am currently a novice software programmer. I am having issues with string handling. I am m...
[15 replies] Last: i don't know if such a thing exists in a downloadable format. You wou... (by jonnin)
by volang
Static const map inside class/struct
 
I want a "global map" inside a class, which can be accessed from anywhere. Is it possible? Something clean like this: struct worker { static cons...
[5 replies] Last: you can overload it normally if you want to access it from objects. ... (by jonnin)
Debug Assertion failed
 
Hello, I'm new in C++ programming (using VS2005). I'm trying to use save file dialog. Here is my code: void CsampleDlg::StopRfWrite() { if (pFile ...
[1 reply] : Somewhere in the call stack is your code. Find the part of your code t... (by Repeater)
If I use malloc in C++, what should I use for casting?
 
#include <cstdio> #include <cstdlib> void main() { // 1 int* p1 = static_cast<int*>(std::malloc(sizeof(int)*10)); std::free(p1); // 2 ...
[3 replies] Last: Your question having been answered, I would nonetheless be remiss, giv... (by Repeater)
getline reads only one line
 
I'm writing at time on a virtual machine. At the first step I'll make an assembler for that, here is the code: /* * This is the code for the assembler progra...
[4 replies] Last: renaming parse() to e.g. assemble()? You'll find that naming things c... (by Ganado)
by volang
Use variable to set size of array within a class
 
Why can "length" be used in the first example but not the second? (Within a class) (1) int length = 20000; char * arr = new char ; (2) int length ...
[5 replies] Last: If you want a container to have its size set at run-time in C++ code u... (by George P)
Is it bad to put all ones code in an hpp and not even use a cpp file?
 
I was taught that one should use an hpp for function prototypes but the actual body of functions and structs should reside in a cpp. Helping a group with some ...
[4 replies] Last: There are several problems putting all your function bodies into a hea... (by MikeyBoy)
capDriverConnect() c++
 
Hi! How avoid window select "Capture Source" calling capDriverConnect() in c++? Thks
[2 replies] Last: Hi, SO Win7. Thks (by Albuquerster)
Any pro can find the solution?
 
Write a program with a function int distinct(int *p, int n); where the parameter pointer p is the base address of an array of size n. The function returns t...
[4 replies] Last: Thank you, dutch! (by Enoizat)
Any way to have the return string alias with the defined name in caller scope?
 
How to have the return string alias can be 'seen' with the defined name in caller scope, without being as global nor passing it off ? illustration is sort of: ...
[8 replies] Last: I am responsible for all your vexations, so say sorry.. it's just a no... (by marhuum)
add llvm obfuscator to aosp
 
hello im looking for some help with switching the compiler used in aosp source to use obfuscator-llvm. currently i am compiling an external native executable fo...
[no replies]
Need help with string and system()
 
I'm trying to use use system() to find the user's name, and set it as a string but it's not working. An example of what I'm trying to do is: #include <iostre...
[3 replies] Last: Thank you Ganado! The name is now stored as a variable and is now able... (by fuerdiekatzen)
How to implement callbacks?
 
Hi, I don't know if callbacks is the right term. Basically, I implemented a red-black tree data structure and I want to make a GUI application with animated ...
[1 reply] : You may pass a function object as the callback. See: http://www.cplus... (by coder777)
speed of Newton's binomial by recursion
 
Hi,I have to have faster code (count Newton's binomial) , and I have not any idea how do this. assumptions: use recursion, use only one function, 0<=K<=N<=33 i...
[13 replies] Last: Love the cod fish. I’m sorry I missed that one. That makes me even... (by George P)
by flav32
adding words to char array
 
I have a sentence stored in char text . I have to rearrange the words like this : one word per line and the words that have at least n letters have priority....
[4 replies] Last: Sorry about that. I figured it though. Here is an example: n=4. "My ... (by flav32)
December 2019 Pages: 123456... 10
  Archived months: [nov2019] [jan2020]

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