c++

OpenSSL Ignore Self-signed certificate error

I'm writing a small program with the OpenSSL library that is suppose to establish a connection with an SSLv3 server. This server dispenses a self-signed certificate, which causes the handshake to fail with this message: "sslv3 alert handshake failure, self signed certificate in certificate chain." Is there a way I can force the connecti...

http header in a packets?

how to retrieve the http header in a packet in c++? any sample code or tutorials can be a big help!.. thanx!.. note: winpcap was used for the packet sniffing and these packets are already filterd to be only tcp and http/s protocols..the only problem is how to decode the packet's http header.. ...

bool operator() and inheritance

I have the following problem with bool operator() for derived class Base class class Point { double x, y; public: Point(){x=0;y=0;} ... } Derived class class 3DPoint : public Point { double z; public: 3DPoint(double x, double y, double zx) : Point(x,y){z(zz);} ... } operator () for derived class class compareByX { bool operator (...

How do I do os.getpid() in C++?

Hi! newb here. I am trying to make a c++ program that will read from a named pipe created by python. My problem is, the named pipe created by python uses os.getpid() as part of the pipe name. when i try calling the pipe from c++, i use getpid(). i am not getting the same value from c++. is there a method equivalent in c++ for os.getpid? ...

Google Test and Visual Studio 2010 RC

Has anyone tried to build gtest 1.4.0 under VS 2010 RC? I get about 400 errors when I try to build it. Thanks in advance. ...

Why does my RSS grow with stack allocated memory

I have written a small server application. It stores a lot of data in strings. When stresstesting it, RSS memory grows (spotted by $top). I have ran the program through "Instrument" - Mac OS X memory leak applicaton and it find only some minor leaks - the memory leaked was a couple of hundred bytes and the program continuously grows. Wh...

Write program like netstat

I would like to write an application like a netstat - to show all the active connections and the open ports respectively. The problem is that I don't know how to do it - I've done some network programming but in general it was some simple server-client packet and simple TCP and UDP packets sending/receiving. I looked at the netstat cod...

Writing to a class pointer gives me an access violation error

Please view this image of the crash after I choose to debug it in MVS2010: http://i48.tinypic.com/dr8q9u.jpg Here's the Game.h header that shows the Game class structure, and in the picture you will see the offending method that's causing the access violation (setBot(botInfo * b)). class botInfo; // Forward declaration class Game { i...

Templated Vector and Colour Maths library (Specialisation)

I have created a maths library that operates via templates, it allows the user to specify the size and type of the array within a class which is then used to create a maths vector of any dimension up to four. As soon as I went to create a colour class, it struck me how similar the vector and colour class are. Is there anyway in which I c...

Trying to use C++ in an iPhone app

I am trying to use c++ in an iphone app. I added the line #include <cstring> in one of my files. I get "error: cstring: no such file or directory". What do I need to do to get it working? My understanding is that gcc is being called, but not g++. How can I change that, or what flag can I add to force gcc to compile c++? ...

Creating a wchar to multibyte char function

The libc library I'm currently using is missing wctomb() so I'm looking to come up with a replacement implementation. What are some complexities I should beware of? Can I simply grab each byte in the wchar and stick them inside an char array? ...

Distributed Computing in C++ ?

Hi everyone, I would like to know what tools, frameworks or libraries you would use, to spread your C++ application across multiple machines. Im searching for a way to create a framework/environment, in which a master-server can hand many seperated Jobs to different seperated clients, who give back their result on a special Job. The res...

What API/SDK to use for this Windows Application?

I'm going to create a utility with GUI that will run on Windows operating systems. It should require minimum (or zero!) amount of additional libraries, files or DLLs to run because it will be executed from an installer. Because of this, i don't want to use .NET for it will require user to install .NET Framework. I know today, most of Wi...

[C++] Vector (push_back); g++ -O2; Segmentation fault

I'm having problem with vector, (in the usage of push_back) but it only appears when using additional g++ flag -O2 (I need it). #include <cstdio> #include <vector> typedef std::vector<int> node; typedef std::vector<node> graph; int main() { int n, k, a, b, sum; bool c; graph g(n, node()); c = scanf("%i%i", &n, &k); ...

How can I build an application like Thunderbird? Which language should I select?

Hi, I don't want to build the Thunderbird functionality. I just want to build a project with plug-in features, cross platform, and easy to install. Is there any document which point to the development of Firefox or Thunderbird? I know the Thunderbird is build in C++, then how can i get these kind of graphics and all other function. P...

usage of hashtable and map

The hashtable and map is hashtable is implemented as a hash function but map is implemented as a tree. My question is, in what situation, hashtable can not be used but a map is a must? ...

c++ , getting the length of an array using strlen in g++ compiler

could someone explain why i am getting this error when i am compiling the source using following g++ compiler #include <cstdio> #include <string> using namespace std; int main() { char source_language[50]; scanf("%16s\n",source_language); int length = sizeof(source_language); int sizeofchar = strlen(source_language)...

How can I get an NPAPI plugin to read an "src" tag

Hi, i'm a little stuck on getting a plugin to work. I need it to take a "src" parameter but I can't seem to make it do this. So i've basically got the npsimple basic plugin. It's probably something really silly i'm missing Joe ...

Combine boost::lexical_cast and std::transform

I would like to write something like this, which cannot be compiled: std::vector<A> as; std::vector<B> bs( as.size() ); std::transform( as.beginn(), as.end(), bs.begin(), boost::lexical_cast<B> ); But this is not working, so I created a functor which is doing this for me: template<typename Dest> struct lexical_transform { templat...

Do other tasks while a system() command is being executed

I have this c++ program that is doing a simple ping on a specified ip address. I am not into networking so i'm just using the system() command in c++ to execute the ping from a shell and store the results in a file, that's easy. The problem is that i want some dots to be printed on the screen while the system() command is being execute...