c++

How program and compile "Hello World" code in kernel mode of linux ?

Yes, as the title, I don't know how to program and compile "Hello World" code in kernel mode of linux , please help me in the shortest and easy to understand way. Thank you ! (Any related document is welcomed too, I'm just new to this) ...

reference and pointer

Possible Duplicate: Difference between pointer variable and reference variable in C++ what is the difference between reference an pointers in c++ ...

Removing duplicates from a QList

For years I have been using the following pattern to remove duplicates from an object of the C++ std::vector type: std::vector<int> cont; std::sort(cont.begin(), cont.end()); cont.erase(std::unique(cont.begin(), cont.end()), cont.end()); Now I am wondering if the same paradigm is the one to be used with the Qt QList<> class, or if the...

is it is possible to run an background process if the window is closed?

hello, i am creating an application in c++ gtk and if i press an button an threading process will start and i need to run the application if the window is closed also is it is possible? ...

Infinite loop using static_cast on this pointer

Hi everybody. Suppose I have two classed Base and Derived, i.e.: #include <iostream> class Base { public: Base () : m_name("Base") { } virtual ~Base () { } virtual void method (std::ostream & out) const { out << m_name << std::endl; ...

Integrating C++ code with any web technology on Linux

hello, i am writing an program in c++ and i need an web interface to control the program and which will be efficient and best programming language ... ...

Why cant' I return bigger values from main function ?

I am trying to return a bigger value like 1000 form my main function, but when I type echo $? it displays 0. If I return a smaller value like 100 it displays the correct value. My Code : int main(void) { return 1000; } Is there any limitation on the values which we can return ? Thanks. ...

Which sorted STL container to use for fast insert and find with a special key?

Hi, I have some data with a key associated with each data item. The key is made of two parts: let's call them color and id. I want to iterate the container by color to speed up rendering and I also want to find items in the container by id alone. I tried using std::map for this with a key class MyKey { public: int color; int id; ...

What are all the member-functions created by compiler for a class? Does that happen all the time?

What are all the member-functions created by compiler for a class? Does that happen all the time? like destructor. My concern is whether it is created for all the classes, and why is default constructor needed? ...

What is the most efficient way to get java buffer in native code under JNI?

Problem: My code native code (c/c++) is called via JNI. Once it's started it needs to get byte[] buffer from Java object several times per second for further heavy processing. Native code should request buffer when processing of previous buffer is completed. The orginal idea was to pass buffer via AF_INET socket to avoid JNI stuff, b...

How can I set tens of thousands of tasks to each trigger at a different defined time?

I'm constructing a data visualisation system that visualises over 100,000 data points (visits to a website) across a time period. The time period (say 1 week) is then converted into simulation time (1 week = 2 minutes in simulation), and a task is performed on each and every piece of data at the specific time it happens in simulation tim...

Extending C++ Win32 application with a C# WPF component

Hello, I need to add a new component to a C++ Win32 application (no CLR support) and I would like to implement the new component in C# and use WPF. This new component is basically a window with some controls, which I need to launch quickly from an option in the menu of the Win32 application. The new component and the existing applicatio...

How do I detect plaintext in a MIME file?

I have a large set of MIME files, which contain multiple parts. Many of the files contain parts labelled with the following headers: Content-Type: application/octet stream Content-Transfer-Encoding: Binary However, sometimes the contents of these parts are some form of binary code, and sometimes they are plaintext. Is there a clev...

Error passing custom Object from QtScript to C++

Hello, I have written a custom class which is available in QtScript through a Prototype. Also another global class is available which should be used to print the custom class generated in QtScript. This is my custom class (very simple ;) ): class Message { public: int source; int target; }; This is the prototype I...

How does a C++ compiler implement thread local storage in C++0x?

How does c++ complier implement thread local storage in C++0x I have searched this in google. But I can't find anything about this. Does anyone have any material about this ?? ...

Templates :Name resolution -->can any one tell some more examples for this statement?

This is the statement from ISO C++ Standard 14.6/7: Knowing which names are type names allows the syntax of every template definition to be checked. No diagnostic shall be issued for a template definition for which a valid specialization can be generated. If no valid specialization can be generated for a template ...

Passing C style string around function

I have a situation as below in which I need to pass a C-style string into a function and stored it into a container that needed to be used later on. The container is storing the char*. I couldn't figure out the efficient way to create the memory and store it into the vector. As in overloadedfunctionA (int), I need to create new memory an...

What does a function object look like if it has a number of parameters?

I have created a very simple Tree implementation, and I would like to be able to pass a function object to my traverse() function. e.g. template<class T> class MyTree { public: void traverse(MyFunction f) { traverse(root, f); } private: MyTreeNode<T>* root; void traverse(MyTreeNode<T>*, MyFunction f); }; T...

Constructors and inheritance?

Lets say I have a class named Car and another which inherits from Car called SuperCar. How can I ensure that Car's costructor is called in SuperCar's constructor? Do I simply do: Car.Car(//args);? Thanks ...

Error with T::iterator, where template parameter T might be vector<int> or list<int>

I'm trying to write a function to print a representation of common STL containers (vector, list, etc..). I gave the function a template parameter T which, for example, might represent vector. I'm having problems getting an iterator of type T. vector<int> v(10, 0); repr< vector<int> >(v); ... template <typename T> void repr(const T & ...