c++

Win32API - How to get file name of process from process handle?

How can I get the file name of process from a process handle? I'm using Win32 C++ (Visual C++ Express Edition). Thanks. ...

In C++, How to get MD5 hash of a file?

I've the file path. How can I get the MD5 hash of it? Thanks ...

are there any tutorials to help a proficient c++ programmer learn c?

I became a professional programmer in the era of object oriented code, and have years of experience programming in C++. I often work on large projects that have years of legacy code in a mix of c++ and c. I feel less comfortable working on pure c parts of systems. From programming in C++ I understand all the c syntax, but there's a hole...

Building FLTK on Windows with Code::Blocks

I'm having a lot of trouble getting FLTK to be compliant when I try to write code in Code::Blocks. I'm guessing this is because I downloaded/installed it incorrectly. I've tried to look for installation guides like http://hpux.connect.org.uk/hppd/hpux/Development/Tools/fltk-1.1.9/readme.html but I don't really know what it means. I've...

Best practice for fetching a collection of items from an object?

I'm dealing specifically with C++, but this is really language-agnostic. Just to give some context into the problem... I have a tree/graph based structure where each node holds a collection of multiple items. I have a class which encapsulates some generic collection (list, map, vector, LinkedList, whatever). I want to be able to fetc...

Where can I get information about the C/C++ linker in Visual Studio?

I'd like to learn more about C/C++ linker issues and troubleshooting in Visual Studio. I've had linker problems crop up from time to time and they are really annoying since you get such limited information from the linker error messages. I've seen a few not-so-detailed MSDN articles but nothing in depth. Where can I find a good source...

Does source incompatibility always imply binary incompatibility?

Any examples demonstrating where source compatibility is broken yet binary compatibility is maintained is welcome. ...

Keeping the contents of an array after its function call ends. (C++)

Lets say I have the following code. double *return_array(void) { double foo[2]; foo[0] = 5; foo[1] = 6; cout << foo << endl; cout << foo[0] << endl << foo[1] << endl; return foo; } double *bar = return_array() cout << bar << endl; cout << bar[0] << endl << bar[1] << endl; Now, bar and foo are still the same pointer ...

How is a "handshake" generally implemented with regards to Named Pipes

I need to implement a handshake type protocol in to a small Linux program that uses named pipes to communicate with other processes. I've searched for a general implementation pattern for a handshake type protocol when using named pipes but I've not been able to turn anything up... I simply can't believe that there isn't patterns to do ...

Initialising a std::string from a character

There doesn't seem to be a standard constructor so I've taken to doing the following void myMethod(char delimiter = ',') { string delimiterString = 'x'; delimiterString[0] = delimiter; // use string version ... } Is there a better way to do this? ...

What is wrong with this usage of the new operator?

Is this allowed? Object::Object() { new (this) Object(0, NULL); } ...

Changing wallpaper on Linux programmatically

How would I change the wallpaper on a Linux desktop (using GNOME) within a C/C++ program? Is there a system API to do it? ...

Can Eclipse CDT do auto-complete when using typedefs?

For all my code Eclipse's autocomplete function is working fine, except when I use a typedef. Example code (someclass.hh): typedef std::vector<int> IntVector; class SomeClass { void sort_int_vector(IntVector &iv) { iv.//eclipse auto complete does not work. (ctrl-space) } } How can I configure Eclipse to do auto-complete in thi...

Does MemoryDC occupied memory or the memory on video card?

I am using the following code to create a compatible DC: m_pDC=new CDC(); VERIFY(m_pDC->CreateCompatibleDC(sampleDC); CBitmap bitmap; if (bitmap.CreateCompatibleBitmap(sampleDC, rect.Width(), rect.Height())) { m_pOldBitmap = m_pDC->SelectObject(&bitmap); } My question is does CDC CBitmap occupied memory ? If it is using memory, wh...

Preventing Debug Spam in eVC4

I have an application that I need to debug on a target system. All the relevant TRACE macros are in place to send messages to the debug window, however, I'm having difficulties in finding a way to prevent the spam there. You see, this application is regularly creating & terminating threads, so I am getting a large amount of "The thread...

Identical build on different systems

I have 3 build machines. One running on windows 2000, one with XP SP3 and one with 64bit Windows Server 2008. And I have a native C++ project to build (I'm building with visual studio 2005 SP1). My goal is to build "exactly" the same dll's using these build machines. By exactly I mean bit by bit (except build timestamp of course). With...

Switch Focus between Cmd windows, Force focus (keep 1 instant of program running)

hello, i am creating a simple windows cmd program, and i am trying to make sure it only runs once (if u double click the exe file, only one instance will show.. so in my code.. i added a named mutex(the name is a GUID) .. if a 2nd instance of the program was started, it would show the message telling you, that you already got an instanc...

C++ Real time console app, simultaneous input and output

I'm writing a quick server app for something so don't really want to write a full GUI. However the problem is that the main part of the server, however the console window will only allow input or output at a time. Many games ive played that have a console in them (usually needs activating in some way or another) they solved this problem...

C++ error detection in Visual Studio 2005

Coming from a different development environment (Java, mostly) I'm trying to make analogies to habits I'm used to. I'm working with a C++ project in Visual Studio 2005, the project takes ~10 minutes to compile after changes. It seems odd that if I make a small syntactical error, I need to wait a few good minutes to get a feedback on tha...

GetModuleFileNameEx - Is it possible to get the path in char* and NOT in TCHAR[]?

Here is my code: TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>"); GetModuleFileNameEx (hProcess, NULL, szProcessName, sizeof(szProcessName)/sizeof(TCHAR)); I need the path in char*, and not in TCHAR[]. Is it somehow possible without converting (WideCharToMultiByte)? Thanks... ...