c++

C++ - Where do i start?

Possible Duplicate: The Best Place to Start Learning C++ Hi All, As a bit of a side project while I'm on my summer break from uni, I've decided to have a look at C++, and get the hang of the basics. I'm by no means a programming novice, I've done web development before with PHP and Ruby, and I've done a fair bit of work with ...

list external drives

in java, you can use File.listRoots() to get all drives in the system. I'm looking to get only the external drives, i.e. USB drives, external hard disks, optical drives, floppy etc'. is there any way to do it in java? if not, native c++ code would be good as well. in that case, i need both windows and linux code thanks ...

Help with WinAPI scroll bars

Right now I have a window with horizontal ad vertical scrollbars. I use these parameters to initialize it. //Set OGL Frame scroll bar SCROLLINFO inf; inf.cbSize = sizeof(SCROLLINFO); inf.fMask = SIF_PAGE | SIF_POS; inf.nPage = 20; inf.nPos = 30; It creates them in the center and I like their size, but when I scroll...

Unsure how to come up with a good design

Hello there, I am having trouble coming up with a good design for a group of classes and was hoping that someone could give me some guidance on best practices. I have kept the classes and member functions generic to make the problem simpler. Essentially, I have three classes (lets call them A, B, and C) as follows: class A { public: ...

Boost singleton trouble

Hi guys, I have some class which uses boost singleton. It calls some function from own c++ library. This library is written in make file as dependence. Now I have another singleton class and it should call first singleton class. After this code I got linkers error about undefined references for functions which are used in first singleton...

Make function declarations based on function definitions

I've written a .cpp file with a number of functions in it, and now need to declare them in the header file. It occurred to me that I could grep the file for the class name, and get the declarations that way, and it would've worked well enough, too, had the complete function declaration before the definition -- return code, name, and par...

why it is up to the compiler to decide what value to assign when assigning an out-of-range value to a variable

in C++ Primer 4th edition 2.1.1, it says "when assigning an out-of-range value to a signed type, it is up to the compiler to decide what value to assign". I can't understand it. I mean, if you have code like "char 5 = 299", certainly the compiler will generate asm code like "mov BYTE PTR _sc$[ebp], 43"(VC) or "movb $43, -2(%ebp)"(gc...

Frame skipping with OpenGL and WinAPI?

Here is my situation. I'm creating a drawing application using OpenGL and WinAPI. My OpenGL frame has scrollbars which renders the screen and modifies GlTranslatef when it gets a scroll message. The problem is wen I get too many shapes the scrollbar is less responsive since it cannot rerender it each and every time it gets a scroll messa...

Dev-C++ and Detours compiling error

Hello. As title says I'm trying to compile with Dev-C++ a simple DLL using Detours, but I get this error: syntax error before token '&' on this lines: DetourAttach(&(PVOID &)trueMessageBox, hookedMessageBox) DetourDetach(&(PVOID &)trueMessageBox, hookedMessageBox) The complete code is #include <windows.h> #include <detours.h> #pr...

Is it possible to catch media stream URL of flash player using NPAPI functions ?

Hi guys. I'm trying to make a video download panel for Chrome likes Real Player's one ( a DLL plugin ).. My question is : "Is it possible to use NPAPI funtions such as NPP_NewStream, NPP_StreamAsFile, NPP_DestroyStream... to catch the media stream URL of flash-player ? " If not, then what part of NPAPI do I have to use ? Thanks.. ...

C++ - Is it possible to implement memory leak testing in a unit test?

I'm trying to implement unit testing for my code and I'm having a hard time doing it. Ideally I would like to test some classes not only for good functionality but also for proper memory allocation/deallocation. I wonder if this check can be done using a unit testing framework. I am using Visual Assert btw. I would love to see some samp...

Strict pointer aliasing: any solution for a specific problem?

I have a problem caused by breaking strict pointer aliasing rule. I have a type T that comes from a template and some integral type Int of the same size (as with sizeof). My code essentially does the following: T x = some_other_t; if (*reinterpret_cast <Int*> (&x) == 0) ... Because T is some arbitary (other than the size restricti...

Synchronizing screencasting (ffmpeg) and capturing from the webcam (OpenCV)

As from my previous questions, I am trying to build a simple eye tracker. Decided to start from a Linux version (run Ubuntu). To complete this task one should organize screencasting and webcam capturing in such way that frames from both streams exactly match each other and there is the same number of frames in each of them totally. Scr...

Why is ::connect() returning EHOSTUNREACH when ssh works fine?

I am calling ::connect() on a special application port in my application and it works fine in general, however, between two particular machines, from one to the other, it fails with EHOSTUNREACH which means "No route to host." If I can ssh on port 22 with no problems, what might be going on here that ::connect() always fails for this pa...

Visual Basic and C++

Hello there, I was reading a little into Visual Basic and it seemed a rather simple way to implement some GUI...So I was looking for a way to interface my C++ code to a Visual Basic snippet of code. For example, receive input from a Visual Basic app and send it over to C++ code to continue the logic of the program based on the input of t...

C++, Qt - How do I get rid of dll dependencies?

Hello! I have compiled my Qt application and now have the following question - now my built project requires QtCore4.dll and QtGui4.dll to be located at the same folder where the .exe file is. (I built my project using MSVS2008 with Qt addon) Q: Is there any way to combine my final application with these .dll files so that they make o...

Generate set/get methods for a c++ class

Is there any tool that generates set and get methods for a class automatically. Just I create classes very frequently and would like to have a tool which for each class-member wil generate the following functions automatically: Member_Type getMemberName() const; //in header file Member_Type getMemberName() const //in source file { ...

C++: Question about freeing memory

On Learn C++, they wrote this to free memory: int *pnValue = new int; // dynamically allocate an integer *pnValue = 7; // assign 7 to this integer delete pnValue; pnValue = 0; My question is: "Is the last statement needed to free the memory correctly, completly?" I thought that the pointer *pnValue was still on the stack and new does...

#define usage in C/C++

I need to write such a define in C/C++ #define scanf( fscanf(inf, in order to replace each scanf( with fscanf(inf, literary But I do not know how... Thanks ...

How to overlay 3d graphics on top of webcam feed live

How can I render 3d graphics on top of a live webcam feed? Visual Studio 2008 c++ Edit: I left the question vague because I do not care what libraries or frameworks are used. I don't care if its Direct3D or OpenGL, or even something else. To bring it the question to a specific point, I would like to render a flat shaded spinning c...