c++

C++ check whether is number is int/float

Hello all, i'm new here. i found this site on google. #include <iostream> using namespace std; void main() { // Declaration of Variable float num1=0.0,num2=0.0; // Getting information from users for number 1 cout << "Please enter x-axis coordinate location : "; cin >> num1; // Getting information from users ...

Static libraries, dynamic libraries, DLLs, entry points, headers ... how to get out of this alive?

Hello, I recently had to program C++ under Windows for an University project, and I'm pretty confused about static and dynamic libraries system, what the compiler needs, what the linker needs, how to build a library ... is there any good document about this out there? I'm pretty confused about the *nix library system as well (so, dylibs,...

expose unmanaged c++ class library to c#

Hi, i have in fact two unamaged c++ libraries, one of them makes use of the other. Both are pretty big, so rewriting is not an option for me. I read some stuff about creating a managed c++ library which wraps arround the unmanaged code. But I don't realy get how to get started, and how to combine all this stuff in one Project... are th...

Launching email application (MAPI) from C# (with attachment)

In the past I have used MAPISendMail to launch Outlook (or whatever the desired MAPI email application was) from a C++ application with a file attachment. (Similar to say Microsoft Word's Send Email functionality). I need to do the equivalent from a C# application and to have it work when running on XP, Vista, Server 2008 (and Windows 7...

How do I implement a Bézier curve in C++?

I'd like to implement a Bézier curve. I've done this in C# before, but I'm totally unfamiliar with the C++ libraries. How should I go about creating a quadratic curve? void printQuadCurve(float delta, Vector2f p0, Vector2f p1, Vector2f p2); Clearly we'd need to use linear interpolation, but does this exist in the standard math library...

Convert CString to character array?

How to convert CString in MFC to char[] (character array) ...

Is there any way to programmatically determine in C/C++ how many parameters a Lua function expects?

Is there a way to determine how many parameters a Lua function takes just before calling it from C/C++ code? I looked at lua_Debug and lua_getinfo but they don't appear to provide what I need. It may seem a bit like I am going against the spirit of Lua but I really want to bullet proof the interface that I have between Lua and C++. Wh...

Slow compilation of boost-based unit test suite

Hi all, I use boost.test library to write unit tests for my application. The problem is, when one particular *.cpp file containing test suite grows up to certain size, compilation of that file becomes extremely slow. I use BOOST_AUTO_TEST_CASE macro to define test cases. Boost version is 1.34.1 Build env is autotools + gcc 4.3 under...

failed accessing COM method after successful cocreateinstance

after successful coInitialize and cocreateinstance (COM server registration is perfect).. When i access a method in class it returns the error: "First-chance exception in XYZ.exe (OLEAUT32.DLL): 0xC0000005: Access Violation". By step by step debugging i found it gives this error while calling // make the call SCODE sc = m_lpDispatch->...

Regular Expression engine that supports raw UTF-8?

Hi, I need a regular expression engine that supports raw UTF-8 - meaning, the UTF-8 string is stored in char * as two chars(or one, or less) - for example, Ab is the array {0x41,0x62}. Anyone know of an regex engine that can receive that format? I can convert to wchar_t if needed first. ...

Picture (logotype) in Vista window header

There is a nice feature in modern windows applications for vista. It is picture in the window header. For instance new skype (v4) and google chrome have it. I was woundering what is technology behinde it? If you switch off aero style, windows still has decaration. Probably application totaly redraw window frame. However, I didn't find ...

Good patterns for a C/C++ plugin-based system?

When developing a C/C++ (=2?) plugin based framework with shared objects/dynamic libraries that need to support live swapping what examples would be helpful to look at for implementation details? Thanks. Note: live swapping is the key point here, no need to restart the system is a requirement ...

COM MFC application don't show window

Hello, I have a MFC application with ATL support, the idea is when someone creates an instance of my interface declared in the mfc application, this instantiation creates and displays a window. This all works fine if the com client is the cmd.exe, i made a quick com client that instance the interface and when this instances occur the ...

How to ensure that a program is running and restart it if needed ?

Hi, I developed a software (in C++) which needs to be continuously running. That basically means that it has to be restarted each time it stops. I was thinking about using cron jobs to check every minutes if it is still alive, but there might be a cleaner way or standard way of doing this. Thanks in advance ...

How to send a link to an application, like Spotify does.

Hi, When we save a level in our editor, we create a log file of any errors it contains. These consist basically of an error message and a path that allows the user to find the erronous item in a tree view. What I want is to make that path a link, something like < a href="editor://path/to/gameobject" > Click to see object in editor< /a ...

In C++ classes, why the semi-colon after the closing brace

Apologies in advance for what is probably a stupid question, but in C++ classes, why the semi-colon after the closing brace? I regularly forget it and get compiler errors, and hence lost time. Seems somewhat superfluous to me, which is unlikely to be the case. Do people really do things like class MyClass { . . . } MyInstance; Edit...

Boost serialization in Qt: is it a proper way?

I'm thinking about serializing data in an application which is Qt-based. Essentially what I'm going to serialize is my hierarchical model, which is composed of different classes that derive from, say, TreeModelItem: class TreeModelItem { protected: QList<TreeModelItem *> m_children; //... }; Should I study boost::serialization an...

Does using SecureZeroMemory() really help to make the application more secure?

There's a SecureZeroMemory() function in WinAPI that is designed for erasing the memory used for storing passwords/encryption keys/similar stuff when the buffer is no longer needed. It differs from ZeroMemory() in that its call will not be optimized out by the compiler. Is it really so necessary to erase the memory used for storing sens...

How to maintain a list of functions in C++/STL ?

Hi, Before asking you my question directly, I'm going to describe the nature of my prolem. I'm coding a 2D simulation using C++/OpenGL with the GLFW library. And I need to manage a lot of threads properly. In GLFW we have to call the function: thread = glfwCreateThread(ThreadFunc, NULL); (the first parameter is the function that'll exec...

How should I link a data Class to my GUI code (to display attributes of object, in C++)?

I have a class (in C++), call it Data, that has thousands of instances (objects) when the code is run. I have a widget (in Qt), call it DataWidget that displays attributes of the objects. To rapidly build the widget I simply wrote the object attributes to a file and had the widget parse the file for the attributes - this approach works, ...