c++

Accessing protected member of template parameter

I have a template class for which I need to access a protected member function of the template parameter, like this: class Foo { protected: void foo() {} }; template<typename T> class Bar { public: static void bar(T& self){self.foo();} }; ... Foo f; Bar<Foo>::bar(f); My problem is getting access to the protected method. I tri...

C/C++ Linking Tutorial

I use gcc. Can someone provide a tutorial or reference for linking external libraries. ...

Is there a way to send a CString to a CFile without writing an actual file?

I have data stored in a CString and it needs to be parsed by an XML parser library. The problem is the XML parser takes in a CFile. It's not ideal to write out the CString to a text file and then reload it into a CFile. Is there any way to directly send the CString to the CFile without making an intermediate output file? ...

Subtractive blending with OpenGL?

I would like to for example draw shapes A, B, C then set the blender, then draw shape D and everywhere where shape D is, the scene shows my background color of (1,1,1,0). Thanks ...

Regarding Hardware Access using C++ and VB.net

I currently have basic knowledge of C++ and VB.Net. For our college project i plan to do something related to Accessing Hardware. I would like to know about some Libraries and functions that can be used to access the monitor and hard disk (Master Boot Record actually) using: C++ VB.Net ...

Thread-Safe implementation of an object that deletes itself

I have an object that is called from two different threads and after it was called by both it destroys itself by "delete this". How do I implement this thread-safe? Thread-safe means that the object never destroys itself exactly one time (it must destroys itself after the second callback). I created some example code: class IThreadCal...

how to search the computer for files and folders.

i need a way to search the computer for files like Windows Explorer. i want my program to search lets say hard drive c:. i need it to search C:\ for folders and files (just the ones you could see in c:\ then if the user clicks on a file on the list like the folder test (C:\test) it would search test and let the user see what files/folder...

How to get a DLL loading process handle

Hi there, I'm trying to get the handle to the process which loaded a dll from the dll. My approach is: in DLL_PROCESS_ATTACH I call EnumWindows(EnumWindowsProc,NULL); my EnumWindowsProc implementation is the following: BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) { if(GetCurrentProcessId() == GetWindowThreadProcessId(hW...

Which C++ compilers use the access specifier in name mangling?

I know MSVC does, and GCC doesn't? What about the others? ...

Method to quickly set up event forward in wxWidgets?

I am developing a GUI that has a canvas and a bunch of controls and crap surrounding it. I want to allow the canvas's event handler a chance to handle events like key presses and such when it doesn't have focus. I want the rest to continue working as normal. Basically what I want to set up is to tell the frame, "Any event you get that...

Is there any hook to access the names of the functions being called at runtime in Xcode?

Is there any hook to access the names of the functions being called at runtime in Xcode? I'm just trying to log the names of all the functions that are called during the lifetime of the process. I have the necessary symbols for the application. I can do it easily in Visual Studio using _penter() and _pexit() functions. But can't find a...

Is wrapping STL idioms for readability a good idea?

Hi, I'm currently working on a C++ project that needs to have as few external dependencies as possible, and thus I'm pretty much sticking to STL and Boost. Until now, I've been almost exclusively living in Qt-land when it comes to C++. In general I tend to use C# and Python when I can. Today I wanted to check whether a std::vector cont...

QtSql: QSqlRecord doesn't keep the table prefixes

I'm working on a small application in Qt and I'm using the SQL library together with SQLite as the database. So far this has worked out well. The QSqlQuery class only provides a method for getting column values by index instead of field name. However, using the record() function the current row on the query can be turned into a QSqlRecor...

Besides Boost, where can I get a single-file smart pointer implementation for C++?

I want to start using smart pointers in my code but I don't really want to use Boost because it's so huge. Can anyone recommend a simple, one-file smart pointer implementation? Thanks, Boda Cydo. ...

Is it possible to use libraries build under VC++ in cygwin gcc build?

I have libraries which are build using VC++. I want to use the same libraries in a program and build in cygwin gcc compiler. Is this scenario will work? ...

Comparing command parameter with argv[] is not working

I am trying to compare the parameter of command with argv[] but it's not working. Here is my code. ./a.out -d 1 In main function int main (int argc, char * const argv[]) { if (argv[1] == "-d") // call some function here } But this is not working... I don't know why this comparison is not working. ...

How to start bluetooth services to connect PC and J2ME fone for data transfer?

I built an app in java as j2me midlet which can discover other bluetooth devices. But it cannot discover their services. I need to be able to transfer some simple numbers from my fone to PC running on Vista. I think it has Broadcom bluetooth h/w! I also got the braodcom SDK but i didnt understand the documentation they provided. It uses ...

Implement callback C# functions for C++ DLL

I'm writing a DLL wrapper for my C++ library, to be called from C#. This wrapper should also have callback functions called from lib and implemented in C#. These functions have for instance std::vector as output parameters. I don't know how to make this. How to pass a buffer of unknown size from C# to C++ via a callback function? Let's t...

C++ BOOST: windows shared memory get_size() returns zero

The below is from the official BOOST docs. Why do I always get size of zero when calling region.get_size() ? What am I doing wrong? int main(int argc, char *argv[]) { //Create a native windows shared memory object. windows_shared_memory shm (create_only, "MySharedMemory", read_write, 1000); //Map the whole shared memory in this ...

Layout direction for Arabic is not determined based on the locale (Mac and Linux)

Has anyone managed to have the correct layout direction (left-to-right and right-to-left) be inferred from the user’s language settings? I am having trouble localizing my application to the Arabic (Saudi Arabia) locale. Detection of the current locale, and loading and installing the appropriate QTranslators both work fine. (The text loo...