c++

What does #pragma comment mean?

#pragma comment(lib, "kernel32") #pragma comment(lib, "user32") ...

Find if point lies within a rectangle.

How can a find if a point lies within a 2D rectangle given 4 points? ...

c++ filling matrix boost

hi i've looked into the vector duplicate of this but couldn't find answer ublas::matrix<int> input; fill(input.begin1(), input.end1(), in_val); fill(input.begin2(), input.end2(), in_val); but it gives me [2,3] {(3,3,3) (3,0,0)} as you can guess i just want to fill all of it with init_val=3 , Thanks. ...

Get list of frequently used programs

Hi, I'm making an application that will collect some information on the user computer for statistical reasons, eg. What programs are installed, does it use wired\wireless connection, default browser, Does it use ms office, open office, other?, etc. I want to know what are the most used programs on the computer. I know windows keeps trac...

Convert triangle strips to triangles?

I'm using the GPC tessellation library and it outputs triangle strips. The example shows rendering like this: for (s= 0; s < tri.num_strips; s++) { glBegin(GL_TRIANGLE_STRIP); for (v= 0; v < tri.strip[s].num_vertices; v++) glVertex2d(tri.strip[s].vertex[v].x, tri.strip[s].vertex[v].y); glEnd(); } The issue is...

C++0x auto, decltype and template functions

I've been reading this CodeProject article on C++0x and have given it a quick try in VC2010. However I've run into a compile error and I'm at a bit of a loss as to what the problem is. #include < iostream> template <typename FirstType, typename SecondType> auto AddThem(FirstType t1, SecondType t1) -> decltype(t1 + t2) { return t1 ...

File and Line number for Debugging

Possible Duplicate: C/C++ line number Hi, I have a simple error manager class that other classes use to report errors which are then printed out to a log file for later examination. I can print out the description and give it error codes. What I would also like, is for it to record the file name and line number where the erro...

Change current working directory C

Hello, I'm trying to figure out a way where I can change my current output directory using C++ code - and also need that method to be platform agnostic. I found the direct.h header file which is Windows compatible, and the unistd.h which is UNIX/POSIX compatible. Any solutions? Cheers. ...

Execute data as code?

My client asked me to write an custom encrypted executable to prevent easy cracking of the licensing system. Now, I understand that this is a false sense of security, but despite this he insisted on it. So, I dug up my knowledge of portable executables and came up with this idea: Encrypt the executable Stick this to the end of a loa...

C++ Iterator do what?

Code: vector<weight *> &res; vector<weight>::iterator it = lower_bound(w.begin(), w.end(), queryweight); while(it != w.end()) { weight *w = &(*it); if(w->weight >= 60) break; res.push_back(w); it++; } I think the lower_bound do a binary search (?), so in the end, does the C++ code intend to get the wei...

C++: Using enum as template type argument

Hi, are there any restrictions / problems using an enum as template (type) argument in C++? Example: enum MyEnum { A, B, C, D, E }; template <typename _t> class MyTemplate { public: _t value; void func(const _t& param) { /* .... */ } }; // .... MyTemplate<MyEnum> MyInstance; My actual problem using MSVC++ via VS 2008...

template class & vector

Implement a template class named MyStack that creates a stack using STL class vector. MyStack class will have two functions – push() and pop(). Since MyStack is a template class, it must be written in such a way that it can be used to create stack of any type of data (both built-in and custom type). When an element of the stack is popped...

WS_EX_LAYERED window does not receive mouse events

I'm coding a custom background non rectangular window with buttons such as minimize and close in bitmaps. Here is my code just for now The problem is the custom window does not receive mouse messages while hovering over non zero alpha regions. ...

problems with global variable shared between sourcefiles (I'm using include guards)

I'm trying to share the same variable between two .cpp files, they include the same .h file. But I'm getting linking errors, telling me that I have multiple definitions. Which I find awkward, since I'm using include guards //main.cpp #include <cstdio> #include "shared.h" int main(){ shared_int = 5; printVal(); return 0; } //sh...

Template classes and the friend keyword in c++ (specific example refers to boost::multi_index)

so you have a class employee class employee { public: employee(const string &name, int id) : m_name(name) , m_id(id) {} const string &getName() const { return m_name; } int getID() const { return m_id; } private: string &m_name; int m_id; }; and you have private data members for encapsulation. But now you want to...

Boost Multi_Index Question

Sorry I can't be more specific in the title. Let's say I have a class Foo class Foo { public: Foo() { m_bitset.reset(); } void set_i(int i) { m_bitset.set(1); m_i = i; } void set_j(int j) { m_bitset.set(2); m_j = j; } bool i_set() { return m_bitset(1); } bool j_set() { retur...

Using HTML Tidy with Visual C++ Express

What are the basic steps to use HTML Tidy under Visual C++ Express Edition? I tried to follow the steps to get the source version using CVS. But CVS asks for a password and even if I use my CVS account password, it states that the target machine does not accept connections. I would really appreciate if someone would guide me using this ...

Creating libcurl http post form

How do i create a curl_form e.g to do a post on stackoverflow? If i look in source of question form page, I see <label for="display-name">Name</label> <input id="display-name" name="display-name" type="text" size="30" maxlength="30" value="" tabindex="105"> </div> <div> <label for...

C++ interface between raw pointers and shared_ptr

I have code that uses raw pointers throughout. It needs to call a method that takes the raw pointer into a shared_ptr. This method is not under my control, belonging to an external api. I cannot just pass the pointer to the shared_ptr because when it will be deleted when the shared_ptr goes out of scope in the method (when the method re...

How to create a new data structure in C++ with object orientation?

Hi! This semester in university I have a class called Data Structures, and the professor allowed the students to choose their favourite language. As I want to be a game programmer, and I can't take Java anymore, I chose C++ ... but now I'm stuck with lack of knowledge in this language. I have to do the following: create a SuperArray, whi...