c++

How to pass variable number of arguments to printf/sprintf

I have a class that holds an "error" function that will format some text. I want to accept a variable number of arguments and then format them using printf. Example: class MyClass { public: void Error(const char* format, ...); }; The Error method should take in the parameters, call printf/sprintf to format it and then do somethi...

Best Technology for a medical 3D Planning Software

I am looking to build a new Interactive 3D planning software similar to this one http://www.materialise.com/materialise/view/en/131410-SimPlant.html I was looking for some expert advise about the best technologies to use to build the different components of the software (ie: UI, Image processing, visualization, 3D, etc.. ) The softwar...

How to start modification with big projects

Hi all, I have to do enhancements to an existing C++ project with above 100k lines of code. My question is How and where to start with such projects ? The problem increases further if the code is not well documented. Are there any automated tools for studying code flow with large projects? Thanx, ...

how to detect datacard connect and disconnect event on win32

Hi All, I have a data card, as soon as i insert the data card, i am getting the events by using wm_device_change event. But I also want to get event, when my data connect actually connects to out side world. I mean to say, as soon as we click on connect/disconnect button of data card,i want to get the event. exactly speaking wanted t...

How to represent 18bit color depth to 16bit color depth?

I'm porting a software that build from 16bit color depth to 18bit color depth. How can I convert the 16-bit colors to 18-bit colors? Thanks. ...

C++ classes as instance variables of an Objective-C class

Hello! I need to mix Objective-C and C++. I would like to hide all the C++ stuff inside one class and keep all the others plain Objective-C. The problem is that I want to have some C++ classes as instance variables. This means they have to be mentioned in the header file, which gets included by other classes and C++ starts spreading to ...

How to represent from 16bit color depth to 18bit color depth?

Possible Duplicate: How to represent 18bit color depth to 16bit color depth? I'm porting a software that build from 16-bit color depth device to 18-bit color depth device? How can I represent the 18-bit color depth? Thanks. ...

Crash on assigning NULL to a pointer in C++(Qtopia-Core-4.3.3) on Linux

Hello, When,i try to assign null value to my pointer,it sometimes crashes on that line. The code is something like this : if(s_counter != NULL) { delete s_counter; s_counter = NULL; // it sometimes crashes here. } This is not reproducable,100%,but it occurs frequently. Can anybody help in this? ...

A question about printf arguments. C/C++.

Hello, We have the following code fragment: char tab[2][3] = {'1', '2', '\0', '3', '4', '\0'}; printf("%s\n", tab); And I don't understand why we don't get an error / warning in the call to printf. I DO get a warning but not an error, and the program runs fine. It prints '12'. printf is expecting an argument of type char *, i.e. a po...

What are practical uses of a protected constructor?

Why would anyone declare a constructor protected? I know that constructors are declared private for the purpose of not allowing their creation on stack. ...

offstream error in c++

Hello, I am getting an ofstream error in C++, here is my code int main () { offstream myfile; myfile.open ("example.txt"); myfile << "Writing this to a file.\n"; myfile.close(); return 0; } error from Dev-C++ 10 C:\devp\main.cpp aggregate `std::ofstream OutStream' has incomplete type and cannot be defined Thanks ...

Is excessive use of this in C++ a code smell

I'm dealing with a large code base that uses the following construct throughout class MyClass { public: void f(int x); private: int x; }; void MyClass::f(int x) { ' ' this->x = x; ' ' } Personally, I'd always used and hence prefer the form class MyClass { public: void f(int x); private: int _x; }; void MyClass::f(int x)...

How to increment an iterator by 2?

Hi Can anybody tell me how to increment the iterator by 2 times. iter++ is available - I have to do iter+2 how can I achieve this. ...

How to add list items in the following manner?

Hi I Have a list that contains dbfile,paths and i need to add them to a map inorder to get corresponding values. my LIST contains items as like star e:\data\star.mdf e:\data\star.ldf kiran e:\data\kiran.mdf e:\data\kiran.ldf hai e:\data\hai.mdf e:\data\hai.ldf Now i need to insert them by populating a list as specified format ma...

C++ distributed programming

Is there any library for distributed in-memory cache, distributed tasks, publish/subscribe messaging? I have used Hazelcast in Java, I would like something similar. I know that Memcached is an in-memory cache and even distributed, but it is missing the messaging and remote task. I just need something to coordinate a cluster of server w...

What if I increment an iterator by 2 when it points onto the last element of a vector?

In this question asking how to adjust the iterator to an STL container by 2 elements two different approaches are offered: either use a form of arithmetic operator - +=2 or ++ twice or use std::advance() I've tested both of them with VC++ 7 for the edge case when the iterator points onto the last element of the STL container or beyon...

How does a hardware trap in a three-past-the-end pointer happen even if the pointer is never dereferenced?

In his November 1, 2005 C++ column, Herb Sutter writes ... int A[17]; int* endA = A + 17; for( int* ptr = A; ptr < endA; ptr += 5 ) { // ... } [O]n some CPU architectures, including current ones, the aforementioned code can cause a hardware trap to occur at the point where the three-past-the-end pointer is created, whethe...

Boost serialization performance: text vs. binary format

Hello! Should I prefer binary serialization over text serialization if performance is an issue ? Does anybody tested it on a large amount of data ? ...

Extending Visual Studio 2003 C++ debugger using autoexp.dat and DLL

I know a solution would be to use VS 2005 or 2008, but that's not an option at the moment. I am supposed to write an extension to the VS 2003 C++ debugger to improve the way it displays data in the watch window. The main reason I am using a DLL rather than just the basic autoexp.dat functionality is that I want to be able to display thin...

Learning more about distributed computing

I'm interested in learning more about distributed computing and how to do it - mostly in C++ but I'd be interested in C# as well. Can someone please recommend some resources? I know very little to nothing about the topic so where should I start? Thanks. ...