c++

4 Colors gradient logic needed

I need to create 4 color gradient logic. One of the posts gave me the pattern to calculate 4 color gradient. However I am having difficutlties to implement it. I am able to calculate color of point E ( middle one) however I do not know how to develop the gradient from it MY code COLORREF NewColor = RGB(255,0,0); COLORREF NewColor2 ...

Weird seg fault problem

Greetings, I'm having a weird seg fault problem. My application dumps a core file at runtime. After digging into it I found it died in this block: #include <lib1/c.h> ... x::c obj; obj.func1(); I defined class c in a library lib1: namespace x { struct c { c(); ~c(); void fun1()...

C++ struct definition

Possible Duplicate: What does unsigned temp:3 means I just found this code in a book (was used in an example) typedef struct { unsigned int A:1; unsigned int B:1; unsigned int C:1; } Stage; What is the meaning of this structure definition? (the A:1;) ...

does VS express conflict with professional ??

I just recently installed VS 2008 Professional on my computer and I already have C++ and C# express on my computer. But for some strange reason I can not find the executable for VS professional 2008. when I go into program files and look under visual studios 2008. All i see is a bunch of tools but no vs 2008 exe ...

CMake cyclic dependency error when custom library name is the same of a system library

Hi guys, i have the following problem. I'm writing a CMakeLists.txt to build a C++ project of mine, which is composed of libhybris.so : A shared library with some exported functions. hybris : An executable which links to libhybris.so A set of various shared libraries which links to libhybris.so The problem is that, libhybris.so depen...

Expand Registry Environment Variable Strings on Remote Machine

After calling RegConnectRegistry(...) to open the registry on a remote machine, is it not possible to expand environment variables? I have looked at ExpandEnvironmentStrings and ExpandEnvironmentStringsForUser, but that only appears to be useful on the local machine. I think it must be possible considering that RegistryKey.GetValue() in ...

Using * Width & Precision Specifiers With boost::format

I am trying to use width and precision specifiers with boost::format, like this: #include <boost\format.hpp> #include <string> int main() { int n = 5; std::string s = (boost::format("%*.*s") % (n*2) % (n*2) % "Hello").str(); return 0; } But this doesn't work because boost::format doesn't support the * specifier. Boost th...

Data parallel libraries in C/C++

I have a C# prototype that is heavily data parallel, and I've had extremely successful order of magnitude speed ups using the Parallel.For construct in .NETv4. Now I need to write the program in native code, and I'm wondering what my options are. I would prefer something somewhat portable across various operating systems and compilers, b...

Programmatically create static arrays at compile time in C++

One can define a static array at compile time as follows: const std::size_t size = 5; unsigned int list[size] = { 1, 2, 3, 4, 5 }; Question 1 - Is it possible by using various kinds of metaprogramming techniques to assign these values "programmatically" at compile time? Question 2 - Assuming all the values in the array are to be ...

C++ - Where to store a global counter?

Hello, everyone. Here's the Minimalist-UML diagram of an app I've been working on. It's supposed to simulate the management of a bunch of sensors relating to different measurements. Please ignore the House class, the diagram is outdated... However, I have trouble. Each sensor (sound, contact, heat, pressure, gas - All of these inheri...

C++: Join an array of WCHAR[]s?

I have an array of WCHAR[]s. How can I join them? I know the array length. [L"foo", L"bar"] => "foo, bar" ...

select() hanging indefinitely

I have an application that runs on embedded linux (older kernel, 2.6.18). I'm using Live555. Occasionally when the camera is heavily loaded, my RTSP server (built using Live555) will hang indefinitely--no amount of connecting or cajoling seems to get it to snap out of it, short of resetting the application. I narrowed the hang down to...

Why is the exception thrown on memcpy using during copying LPBYTE to LPTSTR (clipboard)?

Hello, I have a LPBYTE array (taken from file) and I need to copy it into LPTSRT (actually into the clipboard). The trouble is copying work but unstable, sometime an exception was thrown (not always) and I don't understand why. The code is: FILE *fConnect = _wfopen(connectFilePath, _T("rb")); if (!fConnect) return; fseek(fCo...

Playing sounds over the microphone in c++

Hi, I am making a program in C++ for Windows XP that requires sound to be played so that any program that is currently recording the microphone can hear it, but it will not come out of the speakers. There seems to be no "real" way of doing it, but it is possible to go into "sndvol32 -R" and set the Wave out mix or similar as the current...

Struct containing a Map in a Map? (C++/STL)

I was wondering if it was possible to create a struct containing a number of variables and a map in a map. What I have at the moment: typedef std::map<std::string,double> lawVariables; struct ObjectCustomData { std::string objectType; bool global_lock; std::map<std::string, lawVariables> lawData; }; This struct...

QCroreApplication QApplication with WMI

I found some WMI C++ Application Examples in MSDN website. I have tried the code form the below link http://msdn.microsoft.com/en-us/library/aa390423%28v=VS.85%29.aspx when i copied and run the application as win32 console application it worked well. the same code i ut into the Qt application , When i use QApplication anApplication ...

Fober et al Lock-Free FIFO Queue: multiple consumers and producers?

Hi, I was wondering if the fifo queue presented in Fober et al's paper http://nedko.arnaudov.name/soft/L17_Fober.pdf was a multiple consumer and produce fifo queue. If not, which is the best documented multiple consumer and producer FIFO queue? Thanks ...

ImageMagick++ crashes on Win7/x64

Hi all, I have an ImageMagick-based 32-bit C++ application. Under Windows 7 64-bit, it crashes within ImageMagic on any attempt to read a JPG file. A trivial example like this: #include <Magick++.h> int APIENTRY _tWinMain(...) { Magick::Image img; img.read("D:\\a.jpg"); return 0; } crashes, too. The crash is within STL ...

How can I search PDF?

Hi, Im doing a small project in C++ in LINUX PLATFORM.i need to search 10 or more PDF files and find required data.how can i do so?. i will make my question more clear with following eg suppose i have ten text books all about c++ and i need info about the topic array and how i can search the pdf and find data? thanks in advance ...

Using fflush(stdin)

So a quick google search for fflush(stdin) for clearing the input buffer reveals numerous websites warning against using it. And yet that's exactly how my CS professor taught the class to do it. How bad is using fflush(stdin)? Should I really abstain from using it, even though my professor is using it and it seems to work flawlessly? ...