c++

How to model an OO style interface for C functions?

I have a C module which is created by the Real-time Workshop based on a Simulink Model. This modules provides three public functions: int init(); int calc(double *inputarray, double *outputarray); int term(); Based on the contents of the outputarray, I can model a class called OutputThing. I want to integrate those functions in a wra...

Port Delphi to C++ gradually

Hi I have a large application written in Delphi. I want to renew it, starting with the user interface. I thought about using the new QT. During the process of renewing it, I want to change to C++ as the programming language. Is there a way to gradually rewrite the application (starting with the UI) to change to C++? Thank you for your ...

Final Year MS Project / Enhancement of existing project by collaborative working

I am a final year MS Student and want to do a major project in computer science (preferred langauge is C++) Can you please share project ideas and related pointer for same...? If some one has already done some project and would like to enhance that by collaborative work...do let me know.... ...

Dynamically allocating and setting to zero an array of floats

Hi How do I automatically set a dynamically allocated array of floats to zero(0.0) during allocation Is this OK float* delay_line = new float[filter_len]; //THIS memset(delay_line, 0.0, filter_len); //can I do this for a float?? //OR THIS for (int i = 0; i < filter_len; i++) delay_line[i] = 0.0; Which is the most efficient way ...

RSA algo in symbian c++

hi, i have implemented RSA algo in symbian using class CRSAPublicKey and CRSAPKCS1v15Encryptor wheter it is rightway to implent encryption ...

error: request for member ... in ... which is of non-class type ...

I have a class with two constructors, one that takes no arguments and one that takes one argument. Creating objects using the constructor that takes one argument works as expected. However, if I create objects using the constructor that takes no arguments, I get an error. For instance, if I compile this code (using g++ 4.0.1)... class...

Is there a difference between Boost's scoped mutex and WinAPi's critical section?

The title says it all. In Windows environment, is Boost's scoped mutex using WinAPI's critical sections, or something else? ...

Copy a streambuf's contents to a string

Apparently boost::asio::async_read doesn't like strings, as the only overload of boost::asio::buffer allows me to create const_buffers, so I'm stuck with reading everything into a streambuf. Now I want to copy the contents of the streambuf into a string, but it apparently only supports writing to char* (sgetn()), creating an istream with...

Default construction of elements in a vector

While reading the answers to this question I got a doubt regarding the default construction of the objects in the vector. To test it I wrote the following test code: struct Test { int m_n; Test(); Test(const Test& t); Test& operator=(const Test& t); }; Test::Test() : m_n(0) { } Test::Test(const Test& t) { m_n =...

compare buffer with const char* in C++

What is the correct C++ way of comparing a memory buffer with a constant string - strcmp(buf, "sometext") ? I want to avoid unnecessary memory copying as the result of creating temporary std::string objects. Thanks. ...

CRSAPKCS1v15Encryptor class not found when compiling a Symbian C++ application

I have written code in symbian c++ but i faced one problem CRSAPKCS1v15Encryptor class was not found for aes algo and for rsa algo in symbian cryptosymmetric.h cryptopadding.h file not found is there any plugin required and any other alternative for same functionality ...

How to create a .dll in Visual Studio 2008 for use in a C# App?

I have a C++ class I'd like to access from a C# application. I'll need to access the constructor and a single member function. Currently the app accepts data in the form of stl::vectors but I can do some conversion if that's not likely to work? I've found a few articles online which describe how to call C++ DLLs and some others which de...

Count Processors using C++ under Windows

Using unmanaged C++ on a Windows platform, is there a simple way to detect the number of processor cores my host machine has? ...

several functors for redefining order for sort function of vector

Hello! I have the following data structure: typedef vector< vector<int> > MxInt2d; typedef vector< vector<double> > MxDouble2d; class QSweep{ public: .... static MxDouble2d myPoints_; MxInt2d myEdges_; MxInt2d sweepEvents; class order{ public: bool operator() (const vector<int>& edge1, const vector<int>& edge2){ ...

Delete a registry key recursively

I need to remove a subtree in the Windows registry under Windows Mobile 6. The RegDeleteTree function is not available, and SHDeleteKey is (apparently) not available in any static library under the WM6 SDK, though the declaration is available in shlwapi.h. I tried to get it from shlwapi.dll, like typedef DWORD (__stdcall *SHDeleteKe...

How do I invoke C++ compiler programmatically?

For business reasons, I want to create a C# application that would take a C++ file / snippet as input, compile it (probably invoking a C++ compiler under the hood) and output compilation results. Do you know how this could be done? Thanks in advance. ...

Is there C++ lazy pointer?

I need a shared_ptr like object, but which automatically creates a real object when I try to access it's members. For example, I have: class Box { public: unsigned int width; unsigned int height; Box(): width(50), height(100){} }; std::vector< lazy<Box> > boxes; boxes.resize(100); // at this point boxes contain no any rea...

Find unused function in vc2008?

how to find unused functions in a c++ project vc2008 ...

OpenGL graphics program..

I got stuck with displaying multiple windows in openGL... That is if i display two windows, tranformation is not possible in both the windows... Is there any other way i can do it..??? ...

Need help with connecting c++ and c# code with a c++/cli bridge

I have a client application in native c++ code which is using native c++ dlls. I am investigating the possibility of connecting this code with c# dlls as they would be much easier to write. I decided to write a c++/cli bridge dll which can be loaded with LoadLibrary and which would pass the calls to c# dll. The communication between the...