c++

How do we register Shell extension with a certain file extension

I have tested a small shell extension referring to the article on code project. Though the whole process is quite complicated , I have some how idea what are the follwoing methodsand what do thet do.: Initialize,DragQueryFile,GetCommandString,InvokeCommand,QueryContextMenu But after reading through it I can not understand how Our Co...

Secret to achieve good OO Design

I am a c++ programmer, and I am looking forward to learning and mastering OO design.I have done a lot of search and as we all know there is loads of material, books, tutorials etc on how to achieve a good OO design. Of course, I do understand a good design is something can only come up with loads of experience, individual talent, brillia...

trap invalid opcode rip rsp

We see a couple of below mentioned messages in /var/log/messages for one of our application: Sep 18 03:24:23 kernel: application_name[14682] trap invalid opcode rip:f6c6e3ce rsp:ffc366bc error:0 And Sep 18 03:19:35 kernel: application_name[4434] general protection rip:f6cd43a2 rsp:ffdfab0c error:7b2 I am not able to make what’s these...

pthreads - previously created thread uses new value (updated after thread creation)

So here's my scenario. First, I have a structure - struct interval { double lower; double higher; } Now my thread function - void* thread_function(void* i) { interval* in = (interval*)i; double a = in->lower; cout << a; pthread_exit(NULL) } In main, let's say I create these 2 threads - pthread_t one...

Good way to store a wide variety of structures which sizes also vary?

The title is a bit confusing, so i will explain a bit more using examples. Just a note: i am parsing a file format. Say we have a structure like this: struct example { typeA a; typeB b; typeX x; typeY y; typeZ z; }; So far its ok. Now the problem is, that typeX, typeY and typeZ can vary in size. Depending on flags in th...

C++ template inheritance issue with base types

I have the following code and it fails to compile template < typename T > class Base { public: typedef T * TPtr; void func() { } }; template < typename T > class Derived : public Base< T > { public: using Base< T >::TPtr; using Base< T >::func; TPtr ptr; }; int main( int c, char *v[] ) { Derived< int...

Is multiple function overloading not permitted with virtual functions?

My program compiles fine, but gets core dumped when an overloaded function is called. Below, is the output of the program: FoodID supplied=1 FoodBase constructor called In K constructor In Omlette constructor Omlette handler constructor called In prepare() Omlette Handler Mix called K Prepare called K Egg called DonePreparing called In ...

Microsoft interview Question: Find the errors in this function

I was asked this question in the MS written walkin-interview: Find errors in the program below which is supposed to to return a new string with \n appended to it. char* AddnewlinetoString(char *s) { char buffer[1024]; strcpy(buffer,s); buffer[strlen(s)-1] = '\n'; return buffer; } Thank you all. I'd tried to code on myself a...

How do I use GDB in Eclipse for C/C++ Debugging?

Hi All, I'm a Visual Studio user and is used to breakpoints for debugging. Now I'm working in a linux environment and is using Eclipse as an IDE. I'm a newbie in linux and eclipse. I don't have any idea how to use gdb in eclipse. I tried using gdb in command line, but is not as easy as having a UI. How do I use gdb in eclipse? ...

Detailed description of HID device (USB)

Hi all. I conected my bardcode scanner to USB port. I needed to change the mode from HID keyboard to serial port emulation (the reader is know seen by the system as regular HID device and not a HID system keyboard) to get data from scanner directly to my app. And It's all working great. The problem is that I need to know a VID and PID...

Reading file input as opcode in C++

I am working on a project for a class at school. It is a simple implementation of stacks and queues. However as part of the project we are require to read opcode in from a file. The opcode is formated as follows: append 10 serve append 20 append 30 serve push 10 push 50 push 20 push 20 pop My problem is when I read in the file through...

How can I read the bandwidth in use over the PCIe bus ?

I'm working on a streaming media application that pushes a lot of data to the graphics card at startup. The CPU is doing very little at the point when the data is being pushed, it idles along at close to zero percent usage. I'd like to monitor which machines struggle at pushing the initial data, and which ones can cope, in order that I...

What's faster: inserting into a priority queue, or sorting retrospectively?

What's faster: inserting into a priority queue, or sorting retrospectively? I am generating some items that I need to be sorted at the end. I was wondering, what is faster in terms of complexity: inserting them directly in a priority_queue or a similar data structure, or using a sort algorithm at end? ...

Creating an object on the stack then passing by reference to another method in C++

I am coming from a C# background to C++. Say I have a method that creates a object in a method on the stack, then I pass it to another classes method which adds it to a memeber vector. void DoStuff() { SimpleObj so = SimpleObj("Data", 4); memobj.Add(so); } //In memobj void Add(SimpleObj& so) { memVec.push_back(so); //boost...

OOP Constructor question C++

Let's say that I have two classes A and B. class A { private: int value; public: A(int v) { value = v; } }; class B { private: A value; public: B() { // Here's my problem } } I guess it's something basic but I don't know how to ca...

Will the destructor of the base class called if an object throws an exception in the constructor?

Will the destructor of the base class be called if an object throws an exception in the constructor? ...

uuid_generate_random (libuuid) on solaris

I have a simple C++ function that calls "uuid_generate_random". It seems the generated UUID is not standard compliant (UUID Version 4). Any Ideas? The code I am using is (uuid_generate_random & uuid_unparse functions are available in libuuid): char uuidBuff[36]; uuid_t uuidGenerated; uuid_generate_random(uuidGenerated); uuid_unparse(uu...

Problem with operator <

Hi , I have a problem with the operator < that i wrote: in Node.h : . .. bool operator<(const Node<T>& other) const; const T& GetData (); . .. template <class T> const T& Node<T>::GetData () { return m_data; } template <class T> bool Node<T>:: operator<(const Node<T>& other) const { return (*(this->GetData()) < *(other.GetData())); ...

Image tracker libary

Dear everyone, I'm looking for a library either in C C++ or Java that can track an image. With that I mean I want my program to get the web-cam input recognize an image in front of the web-cam and display for example a movie over the web-cam image. Thank you. I just did some more googling and found that what I want to do is called: ...

QTableView - samples

Hi, How to use QTableView in Nokia QT SDK(for mobiles). I referred some of documents but still I am not clearing about the QTableView. Please any one suggest the how to use the QTableView. I want to show the QTableView with three columns. Thanks is advance. ...