Is there any way in C++ on windows to monitor a program and redirect any outgoing requests it makes on a specific port? I have a simple C++ http proxy and want it to be able to automatically redirect all browser requests on port 80 through itself.
...
There is SysListView32 control.I am trying to get the no of elements in ListView by using API
int iCount = SendMessage(hList,LVM_GETITEMCOUNT,0,0);
LVM_GETITEMCOUNT returns the no of items properly on XP.
But the same call working intermittently on VISTA. On Vista I am getting iCount =0;
GetLastError() on vista returns 0x05.Access de...
struct Node
{
int a;
int b;
};
Node node;
node.a = 2;
node.b = 3;
map<int, int> aa;
aa[1]=1; //O.K.
map<Node, int> bb;
bb[node]=1; //Compile Error
When I tried to map a struct into int, it gave me a compile error.
Why?
Thank you!
...
How can I create a HTTP POST request with some URL encoded parameters using Qt 4.6.1?
I figured out that I can create a QNetworkRequest, set all the parameters there and send it via QNetworkAccessManagers post method. But how can I add some URL-encoded parameters to the request?
In the end I want to access the Eve API using Qt/C++. A P...
I have a list of Parts and some of them need a pointer to an Engine, lets call them EngineParts. What I want is to find these EngineParts using RTTI and then give them the Engine.
The problem is how to design the EnginePart. I have two options here, described below, and I don't know which one to choose.
Option 1 is faster because it doe...
Hi, im just starting to learn about sockets and i have been given this code, and i have to make the port lookup logic work. But the problem is i keep getting this run time error and I dont know why?
// portlookup.cpp
// Given a service name, this program displays the corresponding port number.
#include <iostream>
#pragma comment(lib, "...
I'm trying my hand at throwing together a minor roguelike in C++, but I've run into a problem - in order to get the game to display correctly, the console window has to be a bit wide (around 45 rows, 115 cols). It's easy enough to change by right clicking on the menu bar and setting the defaults for windows with the same name, but is th...
So here's what I have so far:
void sortArray(int amountOfScores, int* testScores)
{
for(int i = 0; i < amountOfScores; i++)
{
for(int j = 0; j < amountOfScores-1; j++)
{
if(*(testScores+i) > *(testScores+j+1))
{
int temp = *(testScores+j);
*(testScores+j) = ...
This is a pretty basic C++ design question:
I have a class that contains some data which is read-only, once the object is constructed:
class Foo {
private:
class Impl;
Impl* impl_;
public:
int get(int i); // access internal data elements
};
Now, I'd like to implement several ways to construct a Foo object and fill it with dat...
I was wondering if there was an API to do networking that would work on Windows, Mac and Linux. I would like to make a card game that 2 people can play through a tcp connection.
Thanks
...
I need to write a relatively simple command line C++ program to be run a Linux environment. However, I would like to code as well as compile this on Windows. The reason I don't want to port it to Linux is because it requires MySQL interactions, and that would require some messy porting (IMO). It does not have to run on Windows; I just wa...
A few days ago I was told that recent versions of g++ produce "better" x86 code than MSVC 2008. Basically GCC with full optimization produces faster applications than MSVC with full optimizations.
While it's certainly correct to state that this, if true, depends a great deal on the application and the C++ code used (and I'm in the proce...
When overloading operators, is it necessary to overload >= <= and !=?
It seems like it would be smart for c++ to call !operator= for !=, !> for operator<= and !< for operator>=.
Is that the case, or is it necessary to overload every function?
...
I have a memory heap manager which partitions the heap into different segments based on the number of processors on the system. Memory can only be allocated on the partition that goes with the currently running thread's processor. This will help allow different processors to continue running even if two different ones want to allocate ...
Does anyone know of an algorithm or data structure relating to selecting items, with a probability of them being selected proportional to some attached value? In other words: http://en.wikipedia.org/wiki/Sampling_%28statistics%29#Probability_proportional_to_size_sampling
The context here is a decentralized reputation system and the atta...
What do these errors mean?
Vector.cpp:13: error: ISO C++ forbids declaration of ‘Vector’ with no type
Vector.cpp:13: error: explicit qualification in declaration of ‘void Vector::Vector(double, double, double)’
The C++ (Line 13 is the Vector::Vector( ...):
#include <iostream>
using namespace std;
namespace Vector
{
Vecto...
Imagine a program with two threads. They are running the following code (CAS refers to Compare and Swap):
// Visible to both threads
static int test;
// Run by thread A
void foo()
{
// Check if value is 'test' and swap in 0xdeadbeef
while(!CAS(&test, test, 0xdeadbeef)) {}
}
// Run by thread B
void bar()
{
while(1) {
...
Hi,
Can anybody explain why partial specialization is not valid for function template but it's fine for class template.
I understand partial specialization might make the compiler get confused with function overloading, but I still need more information to make me totally understand. Can anybody offer me some neat examples?
Thanks!...
Hey im writing an echo client, and for some reason the connectsock function is returning an error, and returning an INVALID_SOCKET. I can't figure out why is this. Can someone tell me why
/*********************************
* echo1.cpp *
* *
* Echo client - version 1 *
**********...
Is there an easy way to figure this out? I guess I can use WM_MOVE to tell me when it begins by keeping a timer. If the window has not received a WM_MOVE message within the last 2 seconds, then I know that it has just begun to move. Then I set another timer and wait for their not to be a message within a period of time (2 seconds). If no...