c++

What are your favorite features of a C/C++ performance profiler / analyzer?

I'm trying to pick a perforamnce analyzer to use. I'm a beginner developer and not sure what to look for in a performance analyzer. What are the most important features? ...

C++ string that can be NULL

I'm used to passing around string like this in my C++ applications: void foo(const std::string& input) { std::cout << input.size() << std::endl; } void bar() { foo("stackoverflow"); } Now I have a case where I want the string to be NULL: void baz() { foo("stackoverflow"); foo(NULL); // very bad with foo implementation above ...

is there a replacement for unistd.h for Windows (Visual C)?

I'm porting a relatively simple console program written for unix to the Windows platform. (VC++ 2005). All the source files include "unistd.h", which doesn't exist. Removing it, i get complaints about misssing prototypes for 'srandom', 'random', and 'getopt'. I know I can replace the random funcs, and I'm pretty sure I can find/hack-u...

testing classes

I put together a class yesterday to do some useful task. I started alpha testing, and at some point realized I was adding alpha test related methods to the class itself. It hit me that they don't belong there. After a bit of head scratching I derived a test class from the base class that has access to the protected members as well. ...

Keyboard Hook... not getting Lower or Upper case characters

The function below is logging the "0", "z" and the "1" ok... but its not capturing the "Z" (shift-z)... any help would be appreciated... __declspec(dllexport) LRESULT CALLBACK HookProc (UINT nCode, WPARAM wParam, LPARAM lParam) { if ((nCode == HC_ACTION) && (wParam == WM_KEYUP)) { // This Struct gets infos on typed key ...

multiple CComboBox sharing the same data.

I have a MFC dialog with 32 CComboBoxes on it that all have the same data in the listbox. Its taking a while to come up, and it looks like part of the delay is the time I need to spend using InsertString() to add all the data to the 32 controls. How can I subclass CComboBox so that the 32 instances share the same data? ...

lptstr to char*

Would anyone hapen to know how to convert a LPTSTR to a char* in c++? Thanks in advance, workinprogress. ...

Problem with SDL_DisplayFormatAlpha (c++)

As I stated in this question, I am using SDL for a small game I'm developing. Now I am having problems with SDL_DisplayFormatAlpha. I am trying to create a surface with an alpha channel from a PNG image. It was working before, but now that I've done some slight refactoring something got broken. I've narrowed it down to this construct...

Simple Asynchronous Multi-Threaded HTTP request library for C++

I'll be quick and honest: I'm currently trying to write a client/server for an online game. Since I'm poor and limited on resources, I'll be testing the bare basics of the server using a PHP backend, with the eventual goal being to rebuild the server end in C++. I'm looking for a C++ library for Windows (XP and Vista preferably) that wi...

Need of Formula for Accurate Bandwith for 1 Gigabit NIC Card

I am Need of Formula to Accurately Calculate Bandwith for 1 Gig Nic Card. What i am doing is send Layer 2 Packets @ 1Gbps but my software is showing 6oo Mbps. The whole experiment is Back to Back. No switch No Router. Here is what i did. // LinkSpeed = 1Gb UINT nBandwidth = LinkSpeed/100;//Mbps nBandwidth = nBandwidth/8; //Bytes/...

How can I get started programming in C++ on Win32?

I have the need/desire to learn to program against Win32 in C++. I am a little confused as to what Win32 even is, as I have no experience on the platform. What would you recommend to get me started programming and debugging C++ programs on Win32? ...

Thread deadlock when using ReadDirectoryChangesW asynchronously

I want to monitor in real-time the changes of several directories in one thread, so I decided to use ReadDirectoryChangesW() method asynchronously with GetQueuedCompletionStatus. Here is my code: static DWORD WINAPI Routine( LPVOID lParam ) { FileSystemWatcher* obj = (FileSystemWatcher*)lParam; obj->hDir[0] = CreateFile( ...

automatic error reporting - recommendations?

Can anyone recommend a library/SDK/etc. that is free or for purchase that I can integrate into my C++ application that enables the application to perform automatic error reporting? I have something now that I am using but it does not catch all exceptions. I'm looking for something more sophisticated and more robust than I have now. Any ...

Is it possible to use signal inside a C++ class?

Ok folks let me see if i can explain this clearly... I am doing something like this: #include <signal.h> class myClass { public: void myFunction () { signal(SIGIO,myHandler); } void myHandler (int signum) { /** * Handling code */ } } I am working on Ubuntu, using gcc. But it wo...

DirectShow, video zoom and image capture for Windows Mobile

Hi, I am currently developing an application for live video streaming (www.livecliq.net) and I would like to add the feature for image capture and video zoom. I've been looking around for the tutorials and resources about DirectShow but so far I have found only a book "Programming Microsoft DirectShow for Digital Video and Television" w...

error LNK2005: _DllMain@12 already defined in MSVCRT.lib

I am getting this linker error. mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj) Please tell me the correct way of eliminating this bug. I read solution on microsoft support site about this bug but it didnt helped much. I am using VS 2005 with Platform SDK ...

Memcached client for Windows in C or C++?

I need a portable C/C++ solution, so I'm looking for a C/C++ client library for Memcached that work on both Windows and Unix. Any suggestions? ...

Signing data with smartcards on Mac in C++

Dear lazyweb, is there any support in Mac OS X for signing data using smartcards? I have looked through the system headers and found only vauge references to smart card support (in SecKeychain.h), which didn't really take me anywhere. If there's no built-in support, which are my options (ie. what free/non-free libraries exist that can ...

How do you validate an object's internal state?

I'm interested in hearing what technique(s) you're using to validate the internal state of an object during an operation that, from it's own point of view, only can fail because of bad internal state or invariant breach. My primary focus is on C++, since in C# the official and prevalent way is to throw an exception, and in C++ there's n...

Fixed width font - Symbian C++ CEikLabel

I want to change the font I am using in a CEikLabel on S60 device I believe I can do the following const CFont* aPlainFont = LatinPlain12(); aLabel->SetFont(aPlainFont); where LatinPlain12 is one from this list.. Albi12 Alp13 Alpi13 Albi13 alp17 Alb17b albi17b alpi17 Aco13 Aco21 Acalc21 LatinBold12 LatinBold13 LatinBold17 LatinBold1...