c++

Using DirectShow AsyncReader with C#

I am running an AsyncReader to open a shared MPG file that is being downloaded by another application (progressive download). The shared MPG file is created with FILE-SHARE-READ | FILE-SHARE-DELETE | FILE-SHARE-WRITE shared permissions. I have even tried every combination of those flags. Here's the problem: within C# the AsyncReader.Loa...

UML - How to manage big class diagrams ?

Hi, For my project report, i need to show the class diagram of the software i've built which counts around 20 classes! The problem, is that when i render the class diagram in jpeg file(either using StarUML or ArgoUMl or whatever..) we can't see the details correctly (very big picture because of the large number of classes). Well, how to...

realloc crashing in previously stable function

Apparently this function in SDL_Mixer keeps dying, and I'm not sure why. Does anyone have any ideas? According to visual studio, the crash is caused by Windows triggering a breakpoint somewhere in the realloc() line. The code in question is from the SVN version of SDL_Mixer specifically, if that makes a difference. static void add_musi...

Detecting reason for failure to open an ofstream when fail() is true

Hello, Seems like this should be simple, but I don't find it in a net search. I have an ofstream which is open() and fail() is now true, I'd like to know the reason for the failure to open, like with errno I would do sys_errlist[errno]. Thanks. -William ...

Calculating larger values of the ackermann function.

I have some code: int CalculateAckermann(int x, int y) { if(!x) { return y++; } if(!y) { return CalculateAckermann(x--,1); } else { return CalculateAckermann(x--, CalculateAckermann(x, y--)); } } Designed to calculate the ackermann function. Above a fairly low number of x and y the ap...

Compiling SystemC library in Mingw32

I have been trying to compile systemC library in Mingw32 and I am getting an error when I run the "configure" command which says that the architecture is not supported. Anyone out there solved this problem? ...

Cross-platform alternative to COM

I've been enamoured with component based programming (be it with COM, another system, or just using the paradigm in plain C++). It requires a bit of getting used to, if one is usually used to the "traditional" OOP model, but it's definetely worth it. It's made my code more maintainable and easier to extend. The project I'm currently wo...

linked list push front

void push_front(const dataType &item) { head=new dnode<dataType> (item,NULL,head); if (!empty()) head->next->prev=head; else tail=head; numItems++; } I have a piece of code here, however I don't really understand it, what is the line head->next->prev=head do ? could anyone please explain, thank...

When to use assembly language to debug a c/c++ program?

When to use the assembly to debug a c/c++ program? Does it help to learn some assembly to debug programs? ...

Can I use ChangeWindowMessageFilter to receive DocumentComplete events from Protected Mode IE?

In my app, I want to open a new IE window, then receive and process DocumentComplete and NavigateComplete2 events fired from the new opened IE. In XP, everything works fine. In Vista, the new IE is running in Protected Mode, so my app is not able to receive DocumentCompelte event from the IE. I do not want to change any security level,...

Does defensive programming violate the DRY principle?

Disclaimer: I am a layperson currently learning to program. Never been part of a project, nor written anything longer than ~500 lines. My question is: does defensive programming violate the Don't Repeat Yourself principle? Assuming my definition of defensive programming is correct (having the calling function validate input instead of t...

Xerces: How to merge duplicate nodes?

My question is this: If I have the following XML: <root> <alpha one="start"> <in>1</in> </alpha> </root> and then I'll add the following path: <root><alpha one="start"><out>2</out></alpha></root> which results in <root> <alpha one="start"> <in>1</in> </alpha> </root> <root> <alpha one="start"> <out>2</out> ...

File Attribute is read only when its folder is read only and the file is not.

Anyone has any idea?? GetFileAttributes returns 32 (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE). The file is C:\WINDOWS\system32\drivers\etc\hosts. Thanks a lot! ...

How to get the structure of software if there is no document?

I am reading a project code, however there is nothing but some .cpp and .h source files. How can I get started and get the structure of the software? ...

C++ 2D Integration Libraries

Can anyone point out a good C++ library that can do 2D numerical integration. It needs to be able to accept a 2D array of known values, and the spacing between the points can be assumed to be constant (for a start). It is preferable that it have a license which allows modifying the code as needed. ...

Drawing On GDI+ Graphics Object a Bitmap using StretchDIBits for Scaling

I am drawing bitmap images on graphics object using DrawImage method But the Images are in large number so it is taking too much time for Drawing. I have read in this forum that using StretchDIBits takes less time for Drawing. I am scaling the image by calling Drawimage but i want any other efficent method. I have a Vector of Bitmap* ...

c++ overloading operators, assignment, deep-copy and addition.

I'm doing some exploration of operator-overloading at the moment whilst re-reading some of my old University text-books and I think I'm mis-understanding something, so hopefully this will be some nice easy reputation for some answerers. If this is a duplicate please point me in the right direction. I've created a simple counter class th...

Flash SMS in Windows Mobile

How can i write code for send Flash SMS (Sms Class 0) in Windows Mobile? please guide me with .NET or C++ code also .Net is better. ...

One question about element inserting in STL list.

CODE: struct Stringdata { // Length of data in buffer. size_t len; // Allocated size of buffer. size_t alc; // Buffer. char data[1]; }; typedef std::list<Stringdata*> Stringdata_list; Stringdata_list strings_; Stringdata *psd = this->strings_.front(); //... if (len > psd->alc - psd->len) alc = sizeof(Stringdata) + buffer_...

Calling virtual functions inside constructors

Suppose I have two C++ classes: class A { public: A() { fn(); } virtual void fn() { _n = 1; } int getn() { return _n; } protected: int _n; }; class B : public A { public: B() : A() {} virtual void fn() { _n = 2; } }; If I write the following code: main() { B b; int n = b.getn(); } One might expect that n is set ...