I'm trying to compile the following code in C++
string initialDecision ()
{
char decisionReviewUpdate;
cout << "Welcome. Type R to review, then press enter." << endl;
cin >> decisionReviewUpdate;
// Processing code
}
int main()
{
string initialDecision;
initialDecision=initialDecision();
//ERROR OCCURS HERE
// Mor...
I am trying to simplify (via make_fn()) the generation of functors that preprocess parameters (via wrap()) for member functions of arity n.
Generating the functors is basically working, but until now only by explicitly specifying the parameter types for the member function.
Now i'd like to generate the correct functor from the member fun...
I'm making a game in c++. It is a card game. I have made 13 cards that rotate about a point to arc out to make your hand. I need a way to figure out which card the user clicks on. My cards are basically rectangles rotated about a point that is in the center of the cards. I was thinking of maybe getting the mouse point and rotating it abo...
I'm creating an application using the fastcgi library, and their method of printing is a little verbose. I'm trying to wrap their fprintf function in my own method:
I would like to turn
FCGX_FPrintF(out, char* fmt, ...);
into
write(char* strFormat, ...);
I've found the magic of va_list but can't find an easy way to pass va_l...
Help me understand this piece of code -
After the first iteration the value of PlcCode becomes A1*. How come? Shouldn't it be A*?
Code = "A1";
char Wild = '*';
TDataString PlcCode(Code);
for (int i = (Code.Len() - 1); i >= 0; i--)
{
PlcCode[i] = Wild;
}
...
My code is stored in a main.cpp file which contains the void main() function, and a class MyClass which I now want to split to another file. IDE is Microsoft Visual Studio 2008 Professional.
myclass.h
#include <tchar.h>
class MyClass {
public:
static bool MyFunction (TCHAR* someStringArgument);
};
myclass.cpp
#include <tchar.h>
...
How to use the Windows API in MinGW?
...
I often write code that renders images by writing pixels directly into buffers and I often find it hard to get a good overview of what's really going on. The Memory window in Visual Studio's debugger is somewhat a help, but I'd really love to see the images graphically.
So my question is, does anyone know of a debugging extension that c...
The example here doesn't make sense, but this is basically how I wrote my program in Python, and I'm now rewriting it in C++. I'm still trying to grasp multiple inheritance in C++, and what I need to do here is access A::a_print from main through the instance of C. Below you'll see what I'm talking about. Is this possible?
#include <ios...
Hello,
My code is using std::count() on a list of an abstract data type that i have defined. (Sommet or Edge in english). But it doesn't work, although i've overloaded the < and == operators like this :
bool operator< (const Sommet &left, const Sommet &right)
{
if(left.m_id_sommet < right.m_id_sommet)
return true;
return fals...
Is there anyway to do something like PHP's
print << END
yadayadayada
END;
in C++? (multi-line, unescaped, easy-to-cut-and-paste stream insertion)
...
I am having some trouble getting a program to link on Windows with VC2008 SP1.
I am explicitly specialising a template member function in a DLL, which appears correctly as an exported symbol in dependency walker, for the correct type, and with the correct arguments.
When I try to call the symbol from an .exe, the linker complains that i...
I'm using a JSON example off the web, as seen below.
{
"menu": "File",
"commands": [
{
"title": "New",
"action":"CreateDoc"
},
{
"title": "Open",
"action": "OpenDoc"
},
{
"title": "Close",
"action": "CloseDoc"
}
]
}
I've tried...
Under MSVC 9.0, this fails. Under g++ this compiles. If we take out the macro then the non-macro version 76-79 compiles. Any ideas?
03: #include <iostream>
04: #include <sstream>
67: #define MAKESTRING(msg, v) \
68: do { \
69: std::ostringstream s; \
70: s << msg; \
71: v = s.str(); \
72: } whil...
How do I save a file with transparency to a JPEG file without Qt making the transparent color black?
I know JPEG doesn't support alpha, and the black is probably just a default "0" value for alpha, but black is a horrible default color.
It seems like this should be a simple operation, but all of the mask and alpha functions I've tried a...
I know that a lot of c/c++ XML library questions have been asked already (I tried to read through all of them before getting to this).
Here are the things I'm going to need in my own project:
Excellent performance
SAX2
Validation
Open source
Cross platform
I was going to use Xerces-C, but I see that a simple SAX2 setup with nothing ...
According to MSDN: "When following a member function's parameter list, the const keyword specifies that the function does not modify the object for which it is invoked."
Could someone clarify this a bit? Does it mean that the function cannot modify any of the object's members?
bool AnalogClockPlugin::isInitialized() const
{
retu...
I'd like to control what is written to a stream, i.e. cout, for an object of a custom class. Is that possible in C++? In Java you could overwride the toString() method for similar purpose. Thanks
...
Is there any predefined function in c++ to check whether the number is square of any number and same for the cube..
...
I've got a C++ unit test that produces useful output to stderr, and mostly noise (unless I'm debugging) to stdout, so I'd like to redirect the stdout to /dev/null.
Curiously enough, doing this seems to cause a segmentation fault.
Is there any reason why code might seg fault with "> /dev/null" and run fine otherwise?
The output is prod...