Hello, all :)
I'm looking for a tool that works on Windows to reformat some C++ code in my codebase. Essentially, I've got some code I wrote a while ago that I'd like to use, but it doesn't match the style I'm using in a more recent project.
What's the best way to reformat C++ code in a standard manner?
Billy3
...
How to pause a program for a few milliseconds using C++ managed code?
I tried Sleep() but it didn't work when I included the winbase.h file, I got lots of compile errors!
for(int i=0; i<10; i++)
{
simpleOpenGlControl1->MakeCurrent();
System::Threading::Thread::Sleep(100);
theta_rotated += 2.0* 3.141592653/(double)Model->size...
Does anyone have a working example of a video player built using Qt phonon? (in C++ )
See my related question here . I am unable to build one using Python.
...
I suppose the naive implementation of a + operator for matrices (2D for instance)
in C++ would be:
class Matrix {
Matrix operator+ (const Matrix & other) const {
Matrix result;
// fill result with *this.data plus other.data
return result;
}
}
so we could use it like
Matrix a;
Matrix b;
Matrix c;
c = a + b;
...
Is this even possible? I've been trying to read a simple file that contains Russian, and it's clearly not working.
I've called file.imbue(loc) (and at this point, loc is correct, Russian_Russia.1251).
And buf is of type basic_string<wchar_t>
The reason I'm using basic_ifstream<wchar_t> is because this is a template (so technically, ba...
I have a class with an object as a member which doesn't have a default constructor. I'd like to initialize this member in the constructor, but it seems that in C++ I can't do that. Here is the class:
#include <boost/asio.hpp>
#include <boost/array.hpp>
using boost::asio::ip::udp;
template<class T>
class udp_sock
{
public:
...
I still feel a bit unsafe about the topic and hope you folks can help me -
For passing data (configuration or results) between a worker thread polling something and a controlling thread interested in the most recent data, I've ended up using more or less the following pattern repeatedly:
Mutex m;
tData * stage; // temporary, ac...
In C++, I've written a mathematical program (for diffusion limited aggregation) where each new point calculated is dependent on all of the preceding points.
Is it possible to have such a program work in a parallel or distributed manner to increase computing speed?
If so, what type of modifications to the code would I need to look into?
...
I recently encountered with this question: How to reduce this expression: s>73?61:60;.
The hint given was that Instead of using conditional operator we could use a simple comparison which will work fine.
I am not sure but I think it is possible with some GCC extension,although I am unable to figure it out myself.
EDIT:The whole expre...
I found this open question online. How do you process a large data file with size such as 10G?
This should be an interview question. Is there a systematic way to answer this type of question?
...
Hi,
I have the following code to take screenshots of a window:
HDC WinDC;
HDC CopyDC;
HBITMAP hBitmap;
RECT rt;
GetClientRect (hwnd, &rt);
WinDC = GetDC (hwnd);
CopyDC = CreateCompatibleDC (WinDC);
hBitmap = CreateCompatibleBitmap (WinDC,
rt.right - rt.left, //width
rt.bottom - rt.top);//height
SelectObject (CopyDC, hBitmap);
//C...
QMessageBox::about( this, "About Application",
"<h4>Application is a one-paragraph blurb</h4>\n\n"
"Copyright 1991-2003 Such-and-such. "
"For technical support, call 1234-56789 or see\n"
"<a href=\"http://www.such-and-such.com\">http://www.such-and-such.com</a>" );
This code is creating the About message box which I wa...
Lets us consider this snippet:
int s;
scanf("%c",&s);
Here I have used int, and not char, for variable s, now for using s for character conversion safely I have to make it char again because when scanf reads a character it only overwrites one byte of the variable it is assigning it to, and not all four that int has.
For conversion I ...
Hi,
I have myself a handle to a bitmap, in C++, on Windows:
HBITMAP hBitmap;
On this image I want to do some Image Recognition, pattern analysis, that sort of thing. In my studies at University, I have done this in Matlab, it is quite easy to get at the individual pixels based on their position, but I have no idea how to do this in C...
Suppose I have a class A.
And B and C are child of A.
Class A has a generic algorithm for sorting arrays of type A, so that I could use it for B and C without writing again the algorithm for each.
In the algorithm, sometimes I have to swap.
The problem is that I can only see the objects as type A, and if I do:
A aux = array[i]
array[...
Hello, How can I get current time (I need hours, minutes, seconds) crossplatform in c++? I saw here make structure of values but there are a lots of another stuff that I don't need. And memory is very important here.
...
So I am writing a program that deals with reading in and writing out to a file. I use the getline() function because some of the lines in the text file may contain multiple elements. I've never had a problem with getline until now. Here's what I got.
The text file looks like this:
John Smith // Client name
123...
I'm just wondering exactly what factors affect how quickly createthread executes, and how long it has to live to make it "worth it".
CONTEXT: Where in my game's loops should I spawn threads?
...
Please tell me how to create a QLabel on the QWidget that has a text that you can click and browser will open the mentioned link.
Please bring here a code snippet.
Thanks!
...
In C++, where are static, dynamic and local variables stored? How about in C and Java?
...