c++

Write a *.doc or *.rtf file from a c/c++ application

How can I write to/generate a *.doc file programmatically using c or c++? Is there a (open source/cross platform) library to do this? If this is not possible, can write an *.odt file and then convert it to *.doc? Thanks in advance! EDIT: Anders Abel commented that *.rtf file type is an option, so any suggestions on this one are also acc...

[DirectDraw] Problem with bliting YUV surface onto the primary surface in Window Mobile

I'm trying to blit YUV hardware surface to the primary surface in WinMobile. Everything works: creation of the surfaces, I test that the passed FourCC code is actually used by querying the surface description, I set puffer pointer (correctly, according to lPitch and width/height of the surface). I verified that it all works properly on P...

Recommendations for cross-platform C/C++ JSON library ?

I'm looking for recommendations for a reliable and functional cross-platform JSON library that can be called from either C or C++ and which can be used with Linux, Mac OS X and WIN32. Ideally it should support both generating JSON output as well as parsing JSON input. I've looked at a lot of the open source options but it's hard to tell...

do i consider (int, double...) as classes

Hi, i'm new to c++ and having a little problem understanding about c++'s casting. According to "C++ Primer", the old style cast is like: int(variable) or (int) variable, and new ones introduced by c++ standard includes static_cast<>, const_cast<>, reinterpret_cast<> and dynamic_cast<>. Is the static_cast<> equivalent to "old style cas...

How to read using C++ (C#) sound stream sent by flash?

Hello. I need to read sound stream sent by flash audio in my C++ application (C++ is not a real limitation, it may be C# or any other desktop language). Now flash app sends audio to another flash app but I need to receive the same audio by desktop application. So, is there a standard or best way how to do it? Thank you for your answer...

Pointers and Variables

I just need some clarification on variables A normal variable has 2 "parts" to it? one part is the actual value and the other part is the location of that value in the memory Is that right? So a pointer variable is just the location part of a normal variable, and it doesn't have value itself? ...

Streaming to QTextEdit via QTextStream

I have often wanted to use QTextEdit as a quick means of displaying what is being written to a stream. That is, rather than writing to QTextStream out(stdout), I want to do something like: QTextEdit qte; QTextStream out(qte); I could do something similar if I emit a signal after writing to a QTextStream attached to a QString....

templates and inheritance issue!

I have a tempated base class check and publically derived class childcheck. the base class also have a partial specializatin but i inherit the childcheck class from the general templated class( not from the partial specialization of the class check). when i call the constructor of the base class from the initialization list of the derive...

Explicit instantiation

Hi guys, After few weeks brake (had to finish couple of assignments for my study, by the way, why God allowed anyone to invent Java?), I'm trying to expand and extend my knowlege of templates with book: Templates - The Complete Guide by David Vandevoorde and Nicolai M. Josuttis, and what I'm trying to understand at this moment is as in t...

Closed-Source applications for linux

I am working on a closed source application that should run on Windows, Mac OS X and major Linux distributions (maybe open-source at a later stage). The program will link against some libraries: boost, Lua, StormLib and zlib. From what I understood there shouldn't be any issues regarding the licenses. It's a C++ command line applicati...

When do you use function objects in C++?

I see function objects used often together with STL algorithms. Did function objects came about because of these algorithms? When do you use a function object in C++? What is its benefits? ...

How to avoid reallocation using the STL (C++)

This question is derived of the topic: http://stackoverflow.com/questions/2280655/vector-reserve-c I am using a datastructur of the type vector<vector<vector<double> > >. It is not possible to know the size of each of these vector (except the outer one) before items (doubles) are added. I can get an approximate size (upper bound) on th...

Is array name a constant pointer in C++?

Hi, I have a question about the array name a int a[10] How is the array name defined in C++? A constant pointer? It is defined like this or just we can look it like this? What operations can be applied on the name? Thanks! ...

is there any easy way to expose methods of private parent class c++

Hello, Is there any way to directly expose some methods of private parent class. In the following example if I have an object of type Child I want to be able to directly call method a() of its parent, but not b(); Current solution spawns a lot of boilerplate code especially if there are a lot of arguments. class Parent { public: ...

How to get PCM data from microphone in C++ (os Windows)?

I need to capture PCM data from microphone in C++. I'm a beginner. How to do it? ...

wxWidgets and context menus

I'm trying to add context menus into a (large) custom control in my application but have run into a number of issues with when to create them. There are 3 cases when a context menu needs to be created (unless I forgot one...) on a right mouse click, when the menu key is pressed and for Shift + F10. In all cases the menu is created and d...

c++ double dispatch with mirrored hierarchies

Hi, the following class hierarchies represent abstract resource handler and resource hierarchies. Both have the interfaces as base classes. Now imagine you write a system where you can implement multiple specific resource systems under these interfaces. Here is just one example. The specific main class creates the resources derived from ...

dynamic_cast fails when used with dlopen/dlsym

Intro Let me apologise upfront for the long question. It is as short as I could make it, which is, unfortunately, not very short. Setup I have defined two interfaces, A and B: class A // An interface { public: virtual ~A() {} virtual void whatever_A()=0; }; class B // Another interface { public: virtual ~B() {} virtual voi...

C++: Any way to 'jail function'?

Well, it's a kind of a web server. I load .dll(.a) files and use them as program modules. I recursively go through directories and put '_main' functors from these libraries into std::map under name, which is membered in special '.m' files. The main directory has few directories for each host. The problem is that I need to prevent usa...

c++ round floating numbers to set precision

I wish to round a floating point number to set precision and return the result from a function. For example, I currently have the following function: inline bool R3Point:: operator==(const R3Point& point) const { // Return whether point is equal return ((v[0] == point.v[0]) && (v[1] == point.v[1]) && (v[2] == point.v[2])); } What ...