c++

Is there a way to find sum of digits of 100! ?

Hey guys , i know there is a way of finding the sum of digits of 100!(or any other big number's factorial) using Python . But i find it really tough when it comes to c++ as the the size of even LONG LONG is not enough. EDIT: i just want to know if there is some other way , i am not aware of which can do the needful. thanks see guys i ge...

Multiple definitions of my template class

Hi, In my library, I have several initialize() and cleanup() functions, for different modules it depends on. To make this part more safe to use, I decided to follow the RAII rule and built up an Initializer template class, that takes two functions as parameters: // initializer.hpp (include guards omitted) template <void initialize(),...

How to get the total amount of shared video memory of a graphic card on Mac OSX?

Using e.g. the command line tool and creating a NSDictionary from the output of: system_profiler -xml SPDisplaysDataType it is possible to get to know the amount of video memory. The key spdisplays_vram contains e.g. the string "512 MB". However, on a graphic card with shared video memory only the identifier spdisplays_integrated_vram ...

CAD like 3D geometry C/C++ library

Dear all, I am looking for a good 3D CAD like library. I need basic geometry shapes (cube, sphere, torus etc.) and the library should make the surface mesh - based on the shapes and some boolean operations. I like VTK. It has great source objects, but unfortunatelly it has no intersection and union filters/commands. I have found many ...

How C++ select() function works in Unix OSs ?

I have used the select() function to implement servers, but now I have to implement it by myself (as a part of a project). int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); Can anyone please help me to implement this function? Any sources, articles? Can anyone explain what is happeni...

Placing Tab Control at runtime issue in MFC

Hi, I am loading background image at runtime in my MFC Application. Like this : m_objMainScrnDC.CreateCompatibleDC(NULL); m_objMainScrnBgBitmap.LoadBitmap(IDB_MAIN_SCRN_BG); And i have tabcontrol on my page at design time , now i want to place a background image for tab control at runtime but i am not able to get that image...

Private data types and member functions.

What does it actually mean when you declare a variable or a member function as private in a C++ class? Besides the obvious fact that, these are accessible only by the member functions, How are they mapped differently on memory, than their public counterparts? ...

How do i make a C++ DLL call my overloaded global new operator?

I have overloaded global new/delete (and new[] / delete[]) to fill and check guarded blocks. Works fine. Now i link to C++ DLLs passing STL-Container instances that are filled or modified by the DLLs. When destructing these containers i run into an error, as they were not allocated using my overloaded new operator and vice versa the dlls...

old-style jpeg in tiff encoding in libtiff

i am tried to encode the ojpeg in tiff the decoding function works well in the all the libtiff version... but encoding is disable.... when i tried to activate that codes it write the ojpeg tiff tags but the images are stored as new jpeg format i.e combination of both can any body help to built the old-style jpeg in tiff encoding ...

High performance logging library for embedded applications

Hello, I am looking for a high performance logging library that I will use on an embedded device. I also want to say that I previously used PaulBunyan logging library which provided an efficient method for transferring information. [By efficient I meant it had a solution for transferring only the __LINE__ and __FILE__ when sending dat...

Useful notepad++ plugins for C / C++ developement?

What are all the helpful plugins available for C / C++ development? ...

Is storing an invalid pointer automatically undefined behavior?

Obviously, dereferencing an invalid pointer causes undefined behavior. But what about simply storing an invalid memory address in a pointer variable? Consider the following code: const char* str = "abcdef"; const char* begin = str; if (begin - 1 < str) { /* ... do something ... */ } The expression begin - 1 evaluates to an invalid m...

Best free Cross-Platform Library for higher level Matrix, Vector and esp. SparseMatrix operations?

Our Platforms: Windows, Linux, Mac OSX. Free: LGPL compatible Support high-level operations: Eigensystems, SVD, QR, LU, inverse, pseudo inverse (aka Moore-Penrose inverse),... Support many matrix types and also good performing small matrices e.g. 3x3: Sparse, Symmetric,... (and also operations on them!, e.g. pseudoInverse()...

IVideoWindow update problem

Hi all! I want to render the video from my webcam into QWidget. I've set QWidget, as a parent to IVideoWindow. Here is the code: m_iVideoWindow->put_Owner((OAHWND)widget_->winId()); m_iVideoWindow->put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN); m_iVideoWindow->put_Left(0); m_iVideoWindow->put_Top(0); widget_->setChild(m_iVideoWindow); A...

NSInvocation not passing pointer to c++ array

Hello, I think I'm making just a fundamental mistake, but I cannot for the life of me see it. I'm calling a method on an Objective-C object from within a C++ class (which is locked). I'm using NSInvocation to prevent me from having to write hundreds methods just to access the data in this other object. These are the steps I'm going t...

C++ and C# for OOP

As far as programming with the object-orientated paradigm go, which is the better, easier-to-use language, C++ or C#? What are the distinct differences. Oh, and is C# a strict-superset of C or not. As a side note, are there any other worthwhile paradigms worth looking at other the OO? (That can be used with C++/C#). ...

Using SQLite with std::iostream

Does someone know a wrapper which would allow SQLite to load its data from an std::iostream? To be more explicit: std::fstream dataStream("database.sqlite"); ... sqlite3_open(...something using dataStream...); I want to use streams because of their modularity: being able to load a file while it is still being downloaded from the netw...

Sharing data array among threads-C++

I know that there are similar questions which are already answered, but I am asking this question since they don’t exactly give what I would like to know. This is about synchronization between threads. The idea of my project is that we obtain data from a data acquisition card and plot and analyze data during data acquisition. So far, I ...

The memory cound not be "read". - random crash

I have a problem with a random crash caused by CSceneNode* pRoot = nodes[0]; // The real problem is = nodes[0]; Crash message is: The instruction at "0x0059d383" referenced memory at "0x00000000". The memory cound not be "read". I do not see the problem, could please help me out ? In Save.cpp void CNESave::SaveLocation(CNELocation* p...

A short programming puzzle

What could the possible explanation for the following puzzle : #include <stdio.h> int main(){ static char *s[] = {"black","white","yellow","violet"}; char *ptr[] = {s+3,s+2,s+1,s},***p; p = ptr; *++p; printf("%s",*--*++p + 3); } output. ...