c++

check if std::cin operator>> has read the whole line

Hello, I'm implementing a little command line parser. Let's say I have a command that requires 2 parameters. I want to let the user type all 3 strings (the command and 2 parameters) on one line, as well as on several lines. Currently I'm having something like this: std::string command; std::cin >> command; std::cout << command << " ent...

Refreshing my knowledge of C++

Possible Duplicates: The Definitive C++ Book Guide and List New to C++, help me get started I'm 15 years rusty on C++; STL was relatively new then. I've done mostly Java since then, and probably have to refresh pointers and memory allocation. I was thinking of picking up the newer version of Stroustrup's C++ book, and read...

Qt - QGraphicsView without ScrollBar

Hi, I am trying to show a picture in it's full view using QGraphicsScene. But when ever I put the QgraphicsScene inside the QGraphicsView, I am getting a scroll bar. I tried so many ways But all are went to veins. So can anybody tell me how to obtain the full view without the scrollbar. ...

Convert a number from Base B1 to Base B2 without using any intermediate base.

Hey Guys Is there a way Convert a number from Base B1 to Base B2 without using any intermediate base. Ex: 214 from base 5 to base 16 without converting it first to decimal and then decimal to hexadecimal. -- Thanks Alok Kr. ...

linking mac framework to qt creator

Hi, I have a project that uses SystemConfiguration.Framework. I've been using xcode, where adding the framework is quite easy, just add it to xcode project's framework. But now, I need my project to be cross platform, so I'm using QT Creator as a single IDE, for Windows and Mac. The problem is that I don't know how to tell QT Creator ...

c++ std::copy with type cast to derived class possible?

Hi, I am pretty sure that there is no way around doing this explicitly but I would like to ask nontheless in case there is a better way. I have a base class A and a derived class B, now I have a std::list of A* which point to B*'s and I want to copy this list of A*'s to a std::vector of B*'s so basically I want to do this: std::list<A*>...

what's the hello world example for using pipe to share resources between processes in c++?

Can you list one? ...

C# VS C++: For IM Project

Our company will start a new project about IM. Currently we have a framework in C++ for IM. But someone thinks C# is better for the project. As I know, Yahoo ever started an IM in C# but gave up at last. Is there any idea about the prons and cons of C++ and C# for the IM project? We only care about windows platform. ...

Load image from memory buffer using ATL CImage

How can I load an image from BYTE* array using CImage ? My workaround until now is to simply create a temporary file, but this operation is very expensive sometimes ... There are probably libraries for that, but I do not want to link to other libraries, all I need is to get image size and effectively display to screen, and CImage is all...

log function misbehaviour!!! Any clue?

Hi guys, I am writing some program in C. It has a part where it does some probability calculations, where I am using log function. normal library function log()... The code is something like this double somevalue = 0.29558101472995091; temp = log(somevalue) And guess what? The temp gets value -1856.0000000000000!!! As the value gi...

Reading C++ code CreateFrame function (from C# prespective)

// Create test video frame void CreateFrame(char * buffer, int w, int h, int bytespan) { int wxh = w * h; static float seed = 1.0; for (int i = 0; i < h; i ++) { char* line = buffer + i * bytespan; for (int j = 0; j < w; j ++) { // RGB line[0] = 255 * sin(((float)i / wxh * seed) * 3.14); line[1] = 25...

Using boost::iterator_facade<>

I have a linked list structure: struct SomeLinkedList { const char* bar; int lots_of_interesting_stuff_in_here; DWORD foo; SomeLinkedList* pNext; }; It is part of an existing API and I cannot change it. I would like to add iterator support. The boost::iterator_facade<> library seemed ideal for the purpose. class Some...

Access result type of a function template parameter in the template?

Given the following template: template<class T> class Container { private: boost::function<T> f; }; ... and its instantiation, perhaps as follows: Container<bool(int, int)> myContainer; , is there a way to access the return type of the function description and compile conditionally against it? For example, if the caller...

malloc: *** error for object 0x1001002e0: pointer being freed was not allocated

please help me I am running the code of api microtik, but I have this error malloc: *** error for object 0x1001002e0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug any body could help me? ...

Getting wireless strength signal in C++

Hi all, I would like to create a little C/C++ program that should be able to detect wireless APs and getting from this some infos, like ID, the strength of the signal ... encryption (open, WPA, WEP) ... stuff like this! Like airodump or network stumbler! This code will be run in a power PC, a console (Wii). Anyone can help me posting s...

C++: overriding pure virtual member variable?

This question is best described in code. I have a class called Vertex that contains an instance of a class called Params: class Params { virtual Params operator + (Params const& p) = 0; }; class Vertex { public: Params operator + (Params const& ap) const { return p + ap }; virtual float eva...

3D text on QGLWidget in Qt 4.6.3

Hello. I'm looking for a simple way to draw 3D text on QGLWidget without using FTGL, FreeType, "render to texture" or framebuffer objects, i.e. using documented Qt 4 functions only, no additional libraries. Ideas? P.S. "3D text" means that letters are flat and have zero thickness, but can be rotated in 3D space. Think about "Star war...

How to determine in C++ the video driver version?

I've got a graphics application that appears to have funky behavior with certain combinations of video cards and drivers. I would like to capture in the application the version number of the video card driver to help with debugging. Is there an easy way to do this? ...

c++ initialization order of globals

Is this portable or at least safe to use with g++? #include <iostream> #include <vector> struct c {}; std::vector<c*> v; struct i : c { i () { v.push_back (this); } } a, b, c; int main () { std::cout << v.size () << "\n"; // outputs 3 with g++ } EDIT: Ok, what I need turned out to be a bit harder: The same code with templates: #...

In NTFS Compressed Directory, How to read Files compressed and uncompressed size?

In our application, we are generating some large ASCII log files to an Windows NTFS compressed directory. My users want to know both the compressed and uncompressed size of the files on a status screen for the application. We are using Rad Studio 2010 C++ for this application. I found this nice recursive routine online to read the siz...