If you have worked with gui toolkits, you know that there is a event-loop/main-loop that should be executed after everything is done, and that will keep the application alive and responsive to different events. For example, for Qt, you would do this in main():
int main() {
QApplication app(argc, argv);
// init code
return a...
This happens at least with wxWidgets 2.8.9 and 2.8.10 on Windows XP, did not test on other patforms:
I have two dlls, a.dll and b.dll, which are VST plugins running in a host sequencer. They make use of wxWidgets and OpenGL. On initialization, I call this in both plugins (but with different m_width and m_height):
MyControl(..)
{
.....
I have:
unsigned char *foo();
std::string str;
str.append(static_cast<const char*>(foo()));
The error: invalid static_cast from type ‘unsigned char*’ to type ‘const char*’
What's the correct way to cast here in C++ style?
...
cout<<"abcd";
sleep(100);
cout<<'\b';
If I want to print the string out and then get back one character ,
why a sleep() is needed here?
But when using printf in C ,it seems that it is not necessary, why?
char* a = "12345";
char* b = "67890";
threadA(){cout<<a;}
threadB(){cout<<b;}
beginthread (threadA);
sleep(100);
beginthread (th...
I'm using RegisterDeviceNotification to watch for changes to a USB device, using the WM_DEVICECHANGE event. However, when I call RegisterDeviceNotification() it returns NULL for the notification handle, which should indicate that it failed. But GetLastError() returns ERROR_SUCCESS and the notifications actually go through.
This causes ...
I am considering the possibility of designing an application that would allow people to develop C++ code graphically. I was amazed when i discovered scratch (see site and tutorial videos).
I believe much of C++ can be represented graphically, with the exceptions of preprocessor instructions and possibly function pointers.
What C++ fea...
It's time for my first question now. How do you cross assignments operators between two classes?
class B;
class A {
public:
A &operator = ( const B &b );
friend B &B::operator = ( const A &a ); //compiler error
};
class B {
public:
B &operator = ( const A &a );
friend A &A::operator = ( const B &b );
};
I searched for how to forward...
What is wrong with using delete instead of delete[]?
Is there something special happening under the covers for allocating and freeing arrays?
Why would it be different from malloc and free?
...
Looking for a good site or book that explains windows threads, preferably for a beginner. Maybe has a example program to run, etc....
...
I have a code that parses some template files and when it finds a placeholder, it replaces it with a value. Something like:
<html>
<head>
<title>%title%</title>
</head>
<body bgcolor="%color%">
...etc.
In code, the parser finds those, calls this function:
string getContent(const string& name)
{
if (name == "title")
re...
I have a 2 forms setup
my first form will call another form with the ShowDialog() method when I receive data from the serial port
ShowDialog() throws InvalidOperation with additionnal information "DragDrop registration did not succeed"
any hints on how to solve this?
...
I was wondering whether it's possible to use Microsoft's C++ compiler and linker with NetBeans IDE?
If so, what's the best way of doing it.
P.S. I'm not interested in Mingw.
EDIT: Is it possible to get NetBeans to do error parsing (so that I can click on error and have NetBeans open the right file), intellisense, etc? I know NetBeans c...
I think it is a simple question for you....i am pretty new in c++.....
So i have a vector defined like this:
vector<vector<float> > big_vector;
I read a file and initialized this vector, then the big_wector has about 200,000 elements in it. each is a vector < float >
Then I wanted to modify the elements in big_vector, for some elemen...
Hello
I have a PHP script that generates a product key for an application written in c++/MFC.
The product key is email to the user and the user copy and pasts it in to my application.
function EncryptData( $data ) {
$key = "abcdefghijklmnopqrstuvwxyz";
// This encrypt method is described here
// http://ca3.php.net/mcrypt
$val =...
I am trying to understand some C++ syntax:
template<class T>
class Foo
{
Foo();
template<class U>
Foo(const Foo<U>& other);
};
template<class T>
Foo<T>::Foo() { /*normal init*/ }
template<class T>
template<class U>
Foo<T>::Foo(const Foo<U>& other) { /*odd copy constructed Foo*/ }
So, I wrote code like this, and it happens...
I'm trying to find a definitive answer and can't, so I'm hoping someone might know.
I'm developing a C++ app using GCC 4.x on Linux (32-bit OS). This app needs to be able to read files > 2GB in size.
I would really like to use iostream stuff vs. FILE pointers, but I can't find if the large file #defines (_LARGEFILE_SOURCE, _LARGEFILE6...
Lets say we have a negative integer say
int a;
is there a faster implementation of
-a?
Do I have to do some bitwise operation on this?
...
I am new to MFC well not entirely new but wanted to ask experts on this forum as why one would choose one project over the other. I hope this is not a stupid question as I am relatively new to MFC.
Thanks so much
...
What happens here:
double foo( const double& x ) {
// do stuff with x
}
foo( 5.0 );
Does the compiler create an anonymous variable and sets its value to 5.0?
Does the x reference a memory location in read-only memory? This is a weird phrasing, I know...
edit: I forgot the const keyword...
...
Is there a simple tutorial for me to get up to speed in SSE, SSE2 and SSE3 in GNU C++? How can you do code optimization in SSE?
...