c++

Why this simple Boost::asio program doesn't work as expected?

I wrote this: #include <vector> #include <iostream> #include <sstream> #include <boost/asio.hpp> #include <tr1/memory> #include <boost/bind.hpp> #include <stdint.h> using namespace boost::asio; using namespace boost::asio::ip; class tcpServer{ public: class connection{ tcp::socket socketConnection; enum {CONNE...

What is going on at the top of this function

I'm currently looking at a function example that I can't seem to figure out using MFC in Visual C++. The function is as follows CMFC_OSG_MDIView::CMFC_OSG_MDIView() :mOSG(0L) { } I understand everything here except the mOSG(0L) snippet. mOSG was declared in the MFC_OSG _MDIView class as follows: cOSG* mOSG; Any help is greatly appr...

Flipping the Y axis in vtk

Is there a way that I can make VTK have the Y axis go down (when increasing values) rather than up? I'd like my VTK windows to match my non-VTK windows in displaying data, which all have the Y axis going down. ...

Can using 0L to initialize a pointer in C++ cause problems?

In this question an initializer is used to set a pointer to null. Instead of using value of 0 value of 0L is used. I've read that one should use exactly 0 for null pointers because exact null pointer representation is implementation-specific. Can using 0L to set a pointer to null cause problems while porting? ...

Best way to add python scripting into QT application?

Hello. I have a QT 4.6 application (C++ language) and i need to add python scripting to it on windows platform. Unfortunately, i never embed python before, and it seems to be a lot of different ways to do so. Can anyone share his wisdom and point me into some articles/documentation i can read to perform a specified task in less painful ...

Is C++ the single language that have both pointers and references?

Amongst the programming languages I know and those I've been exposed to, C++ looks like the only one to have both pointers and references. Is it true? ...

how to use ffmpeg

hello .. im trying to extract frames from a video .. and i picked ffmpeg ( tell me if you know something better ) for this task i downloaded it's source .. and i don't know how to use it ?? how do i compile it ?? what is the recommended language for it ?? i know python and C++ please note that i use windows vista 64x . ...

c++ typecast array

How can one typecast an array of int to an array of float? Thanks. ...

C++ - Hold the console window open?

Hi, my question is super simple, but I'm transitioning from c# to c++, and I was wondering what command holds the console window open in C++? I know in C#, the most basic way is: Console.ReadLine(); Or if you want to let the user press any key, its: Console.ReadKey(true); How do you do this in c++? The only reason I ask this simpl...

CSocket doesn't receive OnClose or OnReceive when you disable network connection on the client side

I've created a client server application with c++ CSocket. when I connect the client to the server and after that I close the client with normal X button or end task it with taskmanager , server CSocket receives the OnClose event. The problem is when I disable the internet connection on windows that the client is running on, server CSock...

Support for C++ refactoring in VS (auto-updating references and header/cpp)

In Visual C# I can rename an entity at its definition, and with two clicks all references to that entity get updated. How do I do this in Visual C++? If it's not supported, is there another IDE that supports it? Note that in the C++ case I also want automatic header/implementation synchronization, so I hardly ever need to do duplicate w...

QT4: Transparent Window with rounded corners

How can i create a partially transparent window with rounded borders (no standard borders)? (i used Qt::FramelessWindowHint to disable standard borders) I tried stylesheets, but "border-radius" and "opacity" doesnt seem to have any effect on the window, it only works on children of the enclosing widget. My second idea was, to make the...

C++ how to test the function to make it throw an error?

The function that needs to be tested is: int hire(Payroll * p) throw(out_of_range, logic_error) { // error if no holes left if (staffcount == MAX_EMPLOYEES) throw (out_of_range("Hire: Too many employees")); // spin down holes looking for a hole. for (int i = 0; i < MAX_EMPLOYEES; ++i) { ...

How to bind c++ dll to my C# program - winCE

hi i need to bind C++ dll to my C# WinCE program. (scanner dll) how i can do it ? thank's in advance ...

c++ - How to get rid of this Constructor error?

Hi there, I've taken 2 OOP C# classes, but now our professor is switching over to c++. So, to get used to c++, I wrote this very simple program, but I keep getting this error: error C2533: 'Counter::{ctor}' : constructors not allowed a return type I'm confused, because I believe I have coded my default constructor right. Here's my co...

Warning on standard headers after upgrading to NetBeans 6.8...

After upgrading to NetBeans 6.8 on my Mac, some standard headers generate a warning. The warning is "There are unresolved includes inside <string>". <string> is just an example and <iostream> and <map> have the same warning. The project builds and runs fine; however, I would like to resolve these warnings. Has anybody else seen this ...

timeval undefined when using windows.h and WIN32_LEAN_AND_MEAN

To avoid conflicts with winsock2.h, I want to wrap my include of windows.h with WIN32_LEAN_AND_MEAN (I undef it after windows.h so as not to interfere with applications that include my headers). Doing this causes timeval to be undefined when winsock2.h isn't included. Including time.h doesn't define timeval either. How can I get timeval...

Why MS Visual Studio 2008 has 2 copies of <sstream> STL file ?

This and this. "c:\Program Files\Microsoft Visual Studio 9.0\VC\crt\src\sstream" "c:\Program Files\Microsoft Visual Studio 9.0\VC\include\sstream" And the files have small differences. Why 2 files ? Thank you. ...

Vista/Win7 Bass and treble volume

Hi guys, I'm having a hard time with this crazy Vista/Win 7 architecture, it might be just me but its hard to get used to it :| So, my current problem is that I cant set the bass and treble values for my sound card, I found that there is a IAudioBass and IAudioTreble interfaces which can do this, but I'm getting lost how to create the...

Getting started with OpenGL programming

Can anyone tell me how to start learning OpenGL? I have small knowledge of C++. Can I write OpenGL programs in C++? If yes, what are the required things to do? Please tell the steps to follow, as if you are saying to a kid. I'm very new to this concept :( ...