c++

on C part of C++ project (VS10)

I have a C++ VS10 project. I want its part to be pure C. So I will have pure C lib and A C++ file that will have part with C code calling that pure Lib. Is it possible? Will I have posebilety to pass data from that C part to C++? ...

If I do a `typedef` in C or C++, when should I add `_t` at the end of typedef'ed type?

I am confused when should I add the trailing _t to typedef'ed types? For example, should I do this: typedef struct image image_t; or this: typedef struct image image; What are the general rules? Another example, should I do this: typdef enum { ARRAY_CLOSED, ARRAY_OPEN, ARRAY_HALFOPEN } array_type_t; or this: typdef enum { ARR...

How to migrate/convert a code of C++ ,built on Borland 2007 to Visual Studio 2010

Please guide me, as how to convert a C++ code of Borland 2007 in to Visual Studion 2010 code. I just need to ask, whether to write all th code again for 2010 or is there any shortcut for this conversion/migration. ...

Unsigned char std::vector to unsigned char[]?

Simple question, how does one create a function which takes an unsigned char std::vector and spits out an unsigned char[] with a length. Thanks! Ah, well it seems my problem was my knowledge of std::vector. I always believed that std::vector did not hold its values in linear fashion. That solves a lot of my problems. Thanks! ...

Algorithm to generate outline of an alpha picture?

I'm trying to figure out an algorithm which can look at raw rgba pixels and return points that make up the polygon of the object inside example: http://img706.imageshack.us/i/polii.png// It doesn't have to return bezier curves or anything smooth or fancy, nor a connected outline as I showed, but basically the points to build such an ou...

Erroneous private base class inaccessible?

Compiling this code using g++ 4.2.1: struct S { }; template<typename T> struct ST { }; template<typename BaseType> class ref_count : private BaseType { }; template<typename RefCountType> class rep_base : public RefCountType { }; class wrap_rep : public rep_base<ref_count<S> > { typedef rep_base<ref_count<S> > base_type; // lin...

Size of a class containing only compile-time constants

If I have a class that contains only compile-time constants, for example, class A { static const int x = 1; static const int y = 2; static const int z = 3; }; I believe it's the case that, so long as the address of the constants is not taken, they can (will?) be replaced at compile time where they are used and will not tak...

Generating a cubic bezier curve from rough points

I'm looking for a way to make my application produce smoother results in freehand mode. Right now it simply adds each mousemove points and makes a polygon out of this. I noticed modern vector applications produce bezier curves to make it look much smoother and im wondering how this is done? So how can I get the 4 points to do bezier inte...

Calling a C++ class from within a view controller crashes

I have a C++ object that I'm getting the reference to in my view controller like this: m_applicationEngine = (ApplicationEngine *)[(GLView *)[self.parentViewController view] m_applicationEngine]; In my location delegate I call a methid in the class like this: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(C...

Why is it ill-formed to have multi-line constexpr functions?

According to Generalized Constant Expressions—Revision 5 the following is illegal. constexpr int g(int n) // error: body not just ‘‘return expr’’ { int r = n; while (--n > 1) r *= n; return r; } This is because all 'constexpr' functions are required to be of the form { return expression; }. I can't see any reason that this...

Function clrscr in C and C++

Does today's C or C++ compilers use the clrscr system function? ...

How to download files from HTTP in Symbian C++?

Hi! I need to download file from HTTP in Symbian C++. Can somebody tell me, how I can do this, couse I cannot find it in Google? ...

How to pass data to many functions

I am new to C++ programming. Now I have a program that consists of millions of lines of code in thousands of files. But when I saw the main() (command line) it was very small. Now how to pass data to so many million functions from such a small main()? There was no text file for parsing or array of structure that contains a function poin...

How to open a file which has name with unicode symbols.

I created an .exe file and associated .myFile extension to that .exe file. I want to double click on any .myFile file and get that file opened by the .exe. For that I have done the following: int main(int argc, char *argv[]) { QString fileName(QObject::tr(argv[1])); if ( fileName != "" ) { mainWin.loadFile(fileName);...

Is factory method appropriate here?

I am generating a sequence of Step objects that differ by "Type" and data contained within. e.g: The Step objects should basically be structs that look like this { GRAB, CASCADE_ONE, FACEUP, SOMEOTHERDATA }, { DROP, DECK, FACEDOWN, MOREDATA, ANDSOMEMORE }, { MOVE, 34, 89 }, where GRAB, MOVE and DROP indicate StepType: typedef enum ...

question about auto in c++

Possible Duplicate: Is there any reason to use the auto keyword in C / C++? can anybody explain me purpose of auto keyword in c++? thanks ...

question about location of variable in memory

we know meaning of pointers for example to get location of variable int t=9; we use following notation int *p=&t; how can i obtain address of variable in memory by bitwise operatos and bits manipulation? can i do it in general or what is equivalent of pointer in bit world?i am using c++ ...

How to convert wchar_t** to char**?

I get argv as wchar_t** (see below), because I need to work with unicode, but I need to convert it to char **. How can I do that? int wmain(int argc, wchar_t** argv) { ...

What are alternatives to the GetShortPathName function?

I'm looking for a function which can return the 'short' (8.3 notation) path for a given 'long' path. However, the GetShortPathName function (which seemed like a perfect fit) doesn't work for me since it requires thata file with the given long path exists already. What other options do I have for computing the 8.3 path for a given long...

Generate symbols for debugging in wndbg

I have an C++ MFC project I'd like to debug with wndbg, and I need to generate the symbols for it when compiling the project. Does anybody know how to do that? I thought that de .pdb files where enough, but wndbg complains it cannot find symbol files at the path where these .pdb file reside for my project. ...