• Forum
  • General C++ Programming

General C++ Programming

by admin
Welcome to this board!
Welcome to the general programming forum in C++.com! In this forum, users can to talk about any topic related to programming in the C++ language that does not ...
[no replies]
Use concepts to test for member functions
Hey guys, I'd like to use concepts to verify that an interface is implented correctly. Usally I would use virtual functions for this. However in this particul...
[4 replies] Last: AH thx alot, now it's working fine :) (by JuliusCaesar)
Wait for stdout completed (C)
For C. Is there a way to wait for all output sent to stdout to be displayed before continuing? I have a situation where I use puts() to display some initialisat...
[9 replies] Last: We don't 'mix' our io with standard output. We only use standard outpu... (by seeplus)
by PeteDD
Use array as incrementer in for loop - no longer compiling
I am in the process of moving some code to a new toolchain and encountered the following code (which is running in many production systems just fine) that will ...
[8 replies] Last: I'm still left wondering why the developer put this variable in as an... (by coder777)
by ruzip
GLUT Keys with VK Keys
I'm looking for a way to make the GLUT key functions to work simultaneously with VK Keys (GetAsyncKeyState) so the other special keys that GLUT cannot detect ...
[2 replies] Last: Thanks kilgar, but actually not involving any external library. And a... (by ruzip)
How to implement FFTW efficiently in C/C++?
From the FFTW documentation: You are probably recreating the plan before every transform, rather than creating it once and reusing it for all transforms of ...
[13 replies] Last: I'm surprised there's even a correlation between thread count and elap... (by helios)
by jNc
send text to clipboard
Having some text that I want to send to clipboard, something like string "random text", I want to call some function (C or 3rd party lib or can be Ubuntu tool)...
[4 replies] Last: It looks like the modern default Ubuntu does not come with a clipboard... (by newbieg)
time elapsed since local midnight?
I need to find the elapsed time (duration) from local midnight. I tried this: // if we have a time_point, must convert to a duration first auto tp = chr::s...
[6 replies] Last: You could also write this without zoned_time if you prefer: int ma... (by mbozzi)
How to get sys_days from local_time?
In attempting to create a today() function, then first idea that comes to mind is this: sys_days{ floor<days>(system_clock::now()) }; but this does ...
[6 replies] Last: Note that for Windows, C++ time zone data is only available from Windo... (by seeplus)
What is a strict weak ordering?
a total ordering means for all a,b in Container, one of the following is true: a < b a == b a > b so, all elements are comparable (this is the total par...
[9 replies] Last: Thanks Helios!! (by JUANDENT)
by Cplusc
Point In Triangle
I am trying to generate points with equal spacing inside complex geometry. I have the STL file representing the triangulation of the surface of the complex geom...
[5 replies] Last: A'ight. (by helios)
How to implement MATLAB's colon operator in C++?
I have the following MATLAB code that uses zero padding to deal with aliasing errors that I would like to rewrite in my C/C++ code. The issue is with the zero p...
[2 replies] Last: If you want zero padded output look to either C's printf or C++20's ... (by George P)
istream_iterator invokes reading from the keyboard by just defining it!!
Hi, The following code opens for reading from the keyboard instead of waiting for the vector: (this does not occur if the istream is an ifstream - associated...
[7 replies] Last: Pressing enter does not end the stream. Correct. This iterates the... (by seeplus)
How can ofstream not trunc existing file?
Hi, I have this code that erases the output file as it opens it... I want to not truncate the file. ofstream os{ to }; ostream_iterator<string> oo{ os...
[2 replies] Last: I think the "problem" with the above code is that is not atomic. Fo... (by kigar64551)
how to insert into an unordered_map for a given struct
Hi, I have this code which gives me an illegal indirection: unordered_map<Record, Record, RHash> rmap; rmap.insert(Record{ "juan"s, 55 }, Record{ "les...
[3 replies] Last: Thanks!! (by JUANDENT)
Uncaught error
Consider for VS2022: #include <iostream> int main() { int i {}; auto pi { &i }; try { delete pi; } catch (...) { std::cout << "Caught!\...
[16 replies] Last: a null pointer is fine, too 0x0000000000000000: I'm done for!... (by helios)
How to open a file that does not exist? For writing...
Hi, I need to open a binary files like this: fstream f; f.open(p, ios::binary | ios::in | ios::out ); but it fails because the file does not exist! I ne...
[3 replies] Last: If you want to open a file for i/o even if it does not exist, try to o... (by seeplus)
by jNc
Ubuntu/CPP emulate CTRL+V
Need to emulate keyboard input short cut Ctrl+V, using cpp or some wrapper/library Having something in copy buffer (just got it with Ctrl+C) Need to execut...
[1 reply] : Maybe, https://stackoverflow.com/questions/1262310/simulate-keypress-i... (by Ganado)
by jNc
get data from text file and send to text field
I need to make something like copy and paste Having file, get string from here, need to send (paste) it to the field where cursor now at. Please advise
[3 replies] Last: Im using Qt Editor, but I think it does not matter. It does matter. ... (by kigar64551)
What does this trick do? using unpack = int[]...
template<typename... T> std::string get_error_message(T&&... args) { std::ostringstream stream; using unpack = int ; static_ca...
[3 replies] Last: Thanks!! (by JUANDENT)
Pages: 12
  Archived months: [jul2023]