c++

Is there an alternative for boost::phoenix::at_c in combination with boost::spirit::qi::grammar

I have created a test application to illustrate my problem. It parses a list of integers preceded by "a=" or "b=" and is separated by "\r\n". The list contains multiple occurrences of those fields in any order. #include <string> #include <vector> #include <iostream> #include <boost/spirit/include/qi.hpp> #include <boost/spirit/includ...

How to list threads opened by every application in Linux?

Is there a way to know, at a real time, what threads are opened and what application opened them? ...

Problems accessing uccapi.dll COM interface C++

Hi, I'm working on a project involving the Microsoft Unified Communications Client API; uccapi.dll. I'm also using Codegear C++Builder 2010, not Visual Studio. After registering the dll with regsvr32 and importing it as type library into C++Builder 2010, uccapi_tlb- and uccapi_ocx-files were generated. When having imported these into my ...

what are the use of interfaces and diffrences with respect to interfaces

What are the major advantages of interfaces in designing application and the differences with respect to inheritance. can any body provide me with the brief example. ...

CodeSourcery giving compilation error: missing bits/c++config.h

Hi Guys, in my project I'm making use of Eigen C++ library for linear algebra. ONLY when I turn on the vectorization flags (-mfpu=neon -mfloat-abi=softfp) for ARM NEON, I get a compiler error - c++config.h no such file or directory. I'm not able to understand whats going wrong, what is this bits/c++config.h? What should I do to fix thi...

Does myVector.erase(myObject) call delete on myObject?

Similar to this question but with objects instead of pointers. If I have the following code Foo f; vector<Foo> vect; vect.push_back(f); vect.erase(vect.begin()); Where does my object go? Is delete called on it? What if someone else holds a pointer to it? Is this a memory leak? ...

Consequences of this buffer overflow?

So here I believe I have a small buffer overflow problem I found when reviewing someone else's code. It immediately struck me as incorrect, and potentially dangerous, but admittedly I couldn't explain the ACTUAL consequences of this "mistake", if any. I had written up a test app to demonstrate the error, but found (to my dismay) that it...

CHUD/CHUD.h: No such file or directory or How to programmatically use shark with iPhone

Hi all, I've included #import <CHUD/CHUD.h> in my header files, and added "-F$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks" to my Framework Search Paths. I also added '-weak_framework CHUD' to my Other Linker Flags. I've tried copying the CHUD.framework folder from /System/Library/PrivateFrameworks to my iOS SDK's System/Librar...

How do I print the string which __FILE__ expands to correctly?

Consider this program: #include <stdio.h> int main() { printf("%s\n", __FILE__); return 0; } Depending on the name of the file, this program works - or not. The issue I'm facing is that I'd like to print the name of the current file in an encoding-safe way. However, in case the file has funny characters which cannot be represe...

how to make screen screenshot with win32 in c++?

how can i make screen-shots of the local pc screen with win32 c++? ...

Convert Mouse Points to Quadratic BSplines

Hi All, I'm writing a drawing program. I'm trying to take an ordered list mouse positions, and approximate a smooth Quadratic BSpline Curve. Does anyone know how to accomplish this? Thanks! ...

square-root and square of vector doubles in C++

Hi, I'd like to calculate the square and square-root of a vector of doubles. For example given: vector<double> Array1(10,2.0); vector<double> Array2(10,2.0); for(unsigned int i=0; i<Array1.size(); i++) Array1[i] = sqrt(Array1[i]); for(unsigned int i=0; i<Array2.size(); i++) Array2[i] = Array2[i] * Array2[i]; Is the...

How to write only regularly spaced items from a char buffer to disk in C++

How can I write only every third item in a char buffer to file quickly in C++? I get a three-channel image from my camera, but each channel contains the same info (the image is grayscale). I'd like to write only one channel to disk to save space and make the writes faster, since this is part of a real-time, data collection system. C++...

Does explicitly calling destructor result in Undefined Behavior here?

In my opinion, the following code (from some C++ question) should lead to UB, but the it seems it is not. Here is the code: #include <iostream> using namespace std; class some{ public: ~some() { cout<<"some's destructor"<<endl; } }; int main() { some s; s.~some(); } and the answer is: some's destructor some's destructor I learned f...

Weird behavior of UuidCreateSequential

Hi, I have a software that runs over 2 000 computers on my company, without any issues. This software, at some time, generate a GUID (or UUID) using UuidCreateSequential() (MSDN link). The call usually returns RPC_S_OK on every computer. But on one of them, it always returns RPC_S_UUID_LOCAL_ONLY. The documentation states that: T...

How are the Poco C++ events handled?

Lets say i have a Poco::Thread: Thread Parent has an eventhandler method within it. The parent then spawns two children threads, who are given events that are the parent subscribes the eventhandler to. So two events both have the same event handler attached. If Child A triggers their event, and Parent starts to execute it, what would hap...

"import" a definition of a function from a base class to implement abstract interface (multiple inheritance in C++)

Say we have a class inheriting from two base classes (multiple inheritance). Base class A is abstract, declaring a pure virtual function foo, the other base class B declares and implements a function foo of the very same signature. struct A { virtual void foo(int i) = 0; }; struct B { virtual void foo(int i) {} }; struct C : publi...

kdevelop: editing CMakeLists.txt

I am having troubles trying to make my project work with kdevelop. In the CMakeLists.txt I have included the paths to the libraries that I use: cmake_minimum_required(VERSION 2.4.6) PROJECT(Ormapi) INCLUDE_DIRECTORIES("/dir/whatever/local/dir/include") < here is defined global.h INCLUDE_DIRECTORIES("/dir/whatever/local/src") ADD...

C++: Creating an uninitialized placeholder variable rather than a default object.

I'm moving from Java to C++ right now and I'm having some difficulties whenever a commonly used concept in Java doesn't map directly into C++. For instance, in Java I would do something like: Fruit GetFruit(String fruitName) { Fruit fruit; if(fruitName == "apple") fruit = new Fruit("apple"); else if(fruitName == "banana") f...

How to get rgb value by cimg?

CImg<unsigned char> src("image.jpg"); int width = src.width(); int height = src.height(); unsigned char* ptr = src.data(10,10); How can I get rgb from ptr? ...