I have a window on thread A, which at some point (as a result of a message being received on its wndproc) triggers an action on thread B, and then waits for the action to complete (using some sort of sync mechanism). Thread B then calls MoveWindow(), to move a child window within thread A's window (a standard textbox, for example). At th...
I'm looking for a good parser generator that I can use to read a custom text-file format in our large commercial app. Currently this particular file format is read with a handmade recursive parser but the format has grown and complexified to the point where that approach has become unmanageable.
It seems like the ultimate solution would...
I am trying to create an app in Qt/C++ with Qt4.5 and want the any active windows to change opacity on a mouseover event...
As i understand it, there is no explicit mouseover event in Qt.
However, I got rudimentary functioning by reimplementing QWidget's mousemoveevent() in the class that declares my mainwindow. But the mainwindow's mo...
Is there a way to call STL libraries from JNI, I believe JNI provides a C like interface for native calls, how do we achieve this for the C++ template libraries?
...
Which is better( or faster) c++ for loop or the foreach operator provided by Qt?
For example,the following condition
QList listofstrings;
Which is better?
foreach(QString str, listofstrings)
{
//code
}
or
int count = listofstrings.count();
QString str = QString();
for(int i=0;i<count;i++)
{
str = listofstrings.at(i);
//code
}
...
Hey Guys
I have a simple wrapper for an Mersenne twister random number generator. The purpose is to scale the number returned by the generator (between 0 and 1) to between argument defined limits (begin and end).
So my function is
inline float xlRandomFloat(float begin, float end) {return (begin+((end-begin)*genrand_real2()));}
I ...
I am wrtting a program in c++ using my own header file.
//main.cpp
#include<iostream>
#include"operation.h"
using namespace std;
main()
{
int a;
cout <<"Enter the value a";
cin>>a;
//class name add
//obj is object of add
add obj;
obj.fun(a);
}
//operation.h
class add
{
void fun(int b)
{
int c,d=10;
c...
I have to work with SQLSERVER SMO in C++. Is Managed code is the only way to work with SQLSERVER SMO in C++ ?
I have tried many ways.. but I found that using managed code is the only option. Are there other ways?
...
Hello,
I am using sqlite database in my arm9 embedded linux platform. I want to reduce writes to disk database because my disk is a flash memory and it needs minimum write cycles. So I tried to increment SQLITE_DEFAULT_CACHE_SIZE as 5000. My objective was to write data to cache and when the cache is filled, automatically flush to disk. B...
Working my way through Effective STL at the moment. Item 5 suggests that it's usually preferable to use range member functions to their single element counterparts. I currently wish to copy all the values in a map (i.e. - I don't need the keys) to a vector.
What is the cleanest way to do this?
...
Any suggestions for my stack based allocator?
(Except for suggestions to use a class with private/public members)
struct Heap
{
void* heap_start;
void* heap_end;
size_t max_end;
Heap(size_t size)
{
heap_start = malloc(size);
heap_end = heap_start;
max_end = size + (size_t) heap_start;
}
...
Hello.
I'm a fairly new C++ programmer and I would like to hear the arguments for and against naming parameters within the class declaration.
Here's an example:
Student.h
#ifndef STUDENT_H_
#define STUDENT_H_
#include <string>
using namespace std;
class Student
{
private:
string name;
unsigned int age;
float h...
I want to make my C++ project cross platform, and I'm considering using Cygwin/MinGW.
But what is the difference between them ?
Another question is whether I will be able to run the binary on a system without Cygwin/MinGW ?
...
I wish to write a program in C# that executes line to line.
By which I mean the equivalent of C++
#include <stdio.h>
int main ()
{
char c;
puts ("Enter q to exit:");
do {
c = getchar();
putchar(c);
} while (c != 'q');
return 0;
}
What would the equivalent in c# be?
...
I hacked a following code:
unsigned long long get_cc_time () volatile {
uint64 ret;
__asm__ __volatile__("rdtsc" : "=A" (ret) : :);
return ret;
}
It works on g++ but not on Visual Studio.
How can I port it ?
What are the right macros to detect VS / g++ ?
...
Hi all,
I'm trying to compile the example from here;
http://msdn.microsoft.com/en-us/library/ms682619(VS.85).aspx
I've installed the Platform SDK, but I'm getting these errors;
Error 1 error LNK2019: unresolved external symbol _GetDeviceDriverBaseNameW@12 referenced in function _main DriverChecker.obj DriverChecker
Error 2 error ...
On linux we can use "time" command.
Or from C++:
#include <sys/time.h>
#include <sys/resource.h>
int getrusage(int who, struct rusage *usage);
How to do a closest thing to that on windows ?
...
I have a qt application in VS2005 which is linked using \subsystem:windows such that when I run the compiled executable it does not create a command line terminal, as well.
I would like to create a command line mode: when I start it with --nogui command line argument, then the gui is not presented but a simple command line program is ru...
I am just curious if there is an elegant way to solve following problem in c++:
I have a simulator app which contains several components connected by channels. The channels may be either network channels (two instances of the app are needed) or dummy local channel. There are two interfaces: IChannelIn and IChannelOut and two correspondi...
A c/c++ app throws that error, how to start to debug (better idea than adding print statements)?
...