Hi SO,
I wrote a client program and a server program, that uses the NTL library and Boost::Asio, to do client/server communication for an integer factorization application, in C++.
Both sides consist of several headers and cpp files. Both project compile fine individually on Windows in Visual Studio. All I did, was add the include path...
suppose we have a
vector<student> allstudent
Now I would like to sort the students using different memebers,such as name, age, address, like that.
How can I do that?
...
I've tried to follow this tutorial on the basics of displaying an image with SDL. But, when I run the program, it returns a blank screen. The image is in the correct directories, but it doesn't display in the program. Am I doing something wrong? I'd really like SDL to work.
EDIT
Here is my code:
#include <SDL/SDL.h>
using namespac...
See this GTK callback function:
static gboolean callback(GtkWidget *widget, GdkEventButton *event, gpointer *data)
{
AnyClass *obj = (AnyClass*) data;
// using obj works
}
(please note the gpointer* on the data). And then the signal is connected using:
AnyClass *obj2 = new AnyClass();
gtk_signal_connect(/*GTK params (...)*/, ...
I am currently working on a game "engine" that needs to move values between a 3D engine, a physics engine and a scripting language. Since I need to apply vectors from the physics engine to 3D objects very often and want to be able to control both the 3D, as well as the physics objects through the scripting system, I need a mechanism to c...
Hello, I need to find the indexes in the vector based on several boolean predicates.
ex:
vector<float> v;
vector<int> idx;
idx=where( bool_func1(v), bool_func2(v), ... );
What is the way to declare **where** function, in order to use the several user defined boolean functions over the vector?
thanks
Arman.
Edit after one week
I...
Does APR 1.2.2 have regex support? Any documentation or tutorials on using it?
The documentation sucks. Like really bad.
...
What's the meaning of ~0 in this code?
Can somebody analyze this code for me?
unsigned int Order(unsigned int maxPeriod = ~0) const
{
Point r = *this;
unsigned int n = 0;
while( r.x_ != 0 && r.y_ != 0 )
{
++n;
r += *this;
if ( n > maxPeriod ) break;
}
return n;
}
...
I am new to cppunit. Is there any way to assert that a value must be less than zero? I am looking for something with similar behavior to CPPUNIT_ASSERT_EQUAL().
...
I have a set of classes which are all derived from a common base class. I want to use these classes polymorphically. The interface defines a set of getter methods whose return values are constant across a given derived class, but vary from one derived class to another. e.g.:
enum AVal
{
A_VAL_ONE,
A_VAL_TWO,
A_VAL_THREE
};
enum B...
I can find many examples on how to do this in managed c++ but none for unmanaged.
I want to get all the pixel data as efficiently as possible, but some of the scan0 stuff I would need more info about so I can properly iterate through the pixel data and get each rgba value from it.
right now I have this:
Bitmap *b = new Bitmap(filena...
I am using the Qt QGraphicsScene class, adding pre-defined items such as QGraphicsRectItem, QGraphicsLineItem, etc. and I want to serialize the scene contents to disk. However, the base QGraphicsItem class (that the other items I use derive from) doesn't support serialization so I need to roll my own code. The problem is that all acces...
I am kind of creating a watchdog which keeps the status log of other processes whose pids are known. I wana know if there is some c++ or c code to get this functionality.
...
I tried this and got the output as:
void
Please explain the following Code:
#include <cstdio>
#include <typeinfo>
using namespace std ;
void foo()
{ }
int main(void)
{
printf("%s",
typeid(foo()).name());// Please notice this line, is it same as typeid( ).name() ?
return 0;
}
AFAIK:
The typeid operator allows the type...
Not sure what to make of this error. Added -D_WIN32_WINNT=0x0501 to Visual Studio's "Command Line" options under Project Properties but it says it doesn't recognize it and the warning still appears.
I am also not sure how to add the Preprocessor Definition. :)
Thanks for any help!
1>Please define _WIN32_WINNT or
_WIN32_WINDOWS app...
I have a problem with printing in C++. As far as I know, this code used to work on my previous printer, but ever since I got another one (an HP C7280) it started giving problems. Whenever I try to print anything, even an empty page, the page JAMS the printer. I have to manualy remove the page from the printer. I have no clue why this is ...
Hey All. Atm im working with native API calls and i have to get RtlInitUnicodeString to work.
The way i use:
const WCHAR wcMutex[] = L"String1";
UNICODE_STRING unicodeMutexBuffer;
RtlInitUnicodeString(&unicodeMutexBuffer,wcMutex);
now my problem the project doesnt compile , i get this error:
Error argument of type "UNICODE_ST...
I'm having an occasional problem with select() timing out on me. I have it set for twenty seconds. The system will handle 100's of transactions correctly, but occasionally one fails with the selet timing out. It does about 1 transaction every few seconds, opening and closing the tcp conncetion with each transaction. I thought the ser...
I have a void pointer and want to access elements from it. How could I transform a void * into an unsigned byte pointer so I can access its elements (which I know are actually unsigned bytes).
Thanks
Using C++
...
I have a struct to store info about persons and multi_index_contaider to store such objects. Mult-index uses for search by different criteria.
I've added several persons into container and want to find person by lastname. It works great, if I use whole lastname. But it returns nothig if I try to find person by a part of a lastname (firs...