I have a simple function, that checks if the strings given match a certain condition, then generate a 3rd string based on the 2 ones received as arguments. The 3rd string is fine but when I return it it suddenly turn into "\n".
string sReturn = "";
if (sText.size() != sPassword.size()) {
//Checks to see if the texts match a conditi...
I want to develop my own tv tuner program mainly for live stream.
Looked at OpenCV but I still prefer to have something that I own, mainly due to customization.
Search over the web and cant seem to find a good site on how to start.
The only clues that I have are things like DirectX, DirectShow.
From what it seems, i believe web cam and ...
I have a class that looks like this:
class Base
{
public:
Base( int val = 0 ) : value( val ) {};
int value;
};
Classes A and B inherit Base:
class A : public Base {};
class B : public Base {};
I also have a templated class with a signature similar to:
template < class T >
class Temp
{
public:
...
I have a vector of ordered container classes where I need to know the index of the container that has a given element
so, I would like to do the following, but this obviously doesn't work. I could create a dummy Container to house the date to find, but I was wondering if there was a nicer way.
struct FooAccDateComp
{
bool operator(...
Hello,
In an application I've been working on, I have to send a 256 x 256 matrix over a socket. I'm developing a visualization client for a offshore system simulator that runs on a cluster, and this matrix is a heightmap representing the current state of the oceanic surface.
This is an realtime application, so speed is a must. And, usi...
I want to begin looking at Direct X, but don't just want to try and throw myself into it. What are some good resources to get ones feet wet?
...
std::vector<std::wstring> lines;
typedef std::vector<std::wstring>::iterator iterator_t;
iterator_t eventLine = std::find_if(lines.begin(), lines.end(), !is_str_empty());
how do I define is_str_empty? i don't believe boost supplies it.
...
In my company, we are using a cross-platform utility library offering a lot of services.
This includes both cross-platform code (e.g. a thread class wrapping either Win32 or pthread API) or every company specific code (e.g. classes to handle proprietary communication protocol between our servers and our clients applications).
We need t...
Couldn't find_if just be an overload of find? That's how std::binary_search and friends do it...
...
Hi,
I'm currently working on an exception-based error reporting system for Windows MSVC++ (9.0) apps (i.e. exception structures & types / inheritance, call stack, error reporting & logging and so on).
My question now is: how to correctly report & log an out-of-memory error?
When this error occurs, e.g. as an bad_alloc thrown by the ne...
Hello,
I'm working on an embedded software in QT that uses LIRC to handle RC (Remote Control) key presses.
I managed to map all the RC keys so directFB is getting keypresses like these:
00000000000011b7 00 MENU
00000000000011a7 00 EXIT
0000000000001193 00 RED
I've created a QT class that uses sockets to grab LIRC keys and generate K...
How do you create a instance of a singleton that can be used in other classes?
For Example:
//Singleton_Class.h
#ifndef Singleton_Class
#define Singleton_Class
class Singleton
{
private:
static Singleton _instance;
Singleton() {}
~Singleton() {}
Singleton(const Singleton &);
Singleton & operator=(const Singleton &);
pub...
If I declare a base class (or interface class) and specify a default value for one or more of its parameters, do the derived classes have to specify the same defaults and if not, which defaults will manifest in the derived classes?
Addendum: I'm also interested in how this may be handled across different compilers and any input on "reco...
I have read this document
http://stackoverflow.com/questions/1376264/initializing-static-array-of-strings-c and tried to test in my compiler if everything would be fine here is copy of code
#include <iostream>
#include <string>
using namespace std;
class MyClass {
public:
const static char* MyClass::enumText[];
};
const cha...
The dynamic_cast operator is returning zero (0) when I apply to a pointer that points to an instance of a multiply inherited object. I don't understand why.
The hierarchy:
class Field_Interface
{
public:
virtual const std::string get_field_name(void) const = 0; // Just to make the class abstract.
};
class Record_ID_Interface
{...
When in doubt, turn to Stackoverflow...
I'm having a problem with string allocation. My goal is to store n length of a passed quoted string. I check m_p for null because I think in debug mode MS likes to set the address to 0xcccccccc instead of 0x00000000.
I passed 1 into length. But when I allocate it using new, I'm getting about 15 ...
Basically I need to generate a nested QVariantMap. (Think JSON):
{ "foo" : 1, "bar" : { "node" : 0 } }
I do this in Qt this way:
QVariantMap r, r_bar;
r["foo"] = QVariant(1);
r_bar["node"] = QVariant(0);
r["bar"] = r_bar;
Which is very inconvenient for large nested structures. Is there an elegant way of doing this, such as this (...
I'm a .net developer by heart and usually write web applications. However I've been given the binary of a small project and I need to compile it (I think).
It is only two files: mfile.h and mfile.cpp. From looking at the code the .h file is a header file that contains constants and the cpp file is the actual codefile.
I created a ne...
I have written a program (Mimer 1.1 -- http://sourceforge.net/projects/mimer/files/) and after 3000 downloads I found out that my own Nod32 Antivirus detects my program as a Win32/Agent.NFIWJLP trojan. My program has a c++ sub program that makes a system hook to watch the keyboard and mouse movements and events in the system (similar to ...
I'm reading the phoneME's source code. It's a FOSS JavaME implementation. It's written in C++, and I stumbled upon this:
// Makes a string of the argument (which is not macro-expanded)
#define STR(a) #a
I know C and C++, but I never read something like this. What does the # in #a do?
Also, in the same file, there's:
// Makes a strin...