c++

Why is printf showing -1.#IND for FPTAN results?

I am working on a program which produces assembler code from expressions. One of the functions required is tan(x) which currently works using the following sequence of code (the addresses are filled in at run time): fld [0x00C01288]; fld st(0); fsin; fld st(1); fcos; fdivp; fst [0x0030FA8C]; However, I would like to use the FPTAN opco...

Complex statements in the member initialization part??

I have this: struct myClass{ multiset<string,binPred<string> > values ; myClass(const char param1, const char param2) : values(less<string>()) { } } ; I need to initialize the values member with a different functor depending on the values of param1 and param2. Unfortunately, the logic to decide which functor to use is not...

Wildcard search does not work on Mail Merge Fields (MS Word)

I wonder whether anyone ran into this issue before - I spend a dozen of hours but could not figure out. I am writing a Word AddIn in C++. The AddIn is to convert anything between < and >. It works just fine for plain text, but does not work on Mail Merge fields. For example, worked if I typed it, but if the same 'Jane' came from a ma...

CEdit numeric validation event C++ MFC

Hi, I have a CEdit text box which is a part of a property pane and only allows numeric values (positive integers). The box works fine when people enter non-numeric values, but when they delete the value in the box a dialog pops up saying: "Please enter a positive integer." Here is the situation: 1. I have a number (say 20) in the box. ...

Converting a C++ .exe project to a dll

Microsoft provides the source code of vshadow to manipulate VSS (Volume Shadow Service [shadow copy]), and I've modified it a bit but I want to make it into a dll so I can use it in my C# projects. I don't know exactly how to go about doing that, the source code is fairly simple, and it shouldn't be too hard, but I don't really know wher...

How to determine the actual level of development in a shop, e.g. C++ vs. C?

I imagine most of you know what I am getting at. You start a new job and within the first week or so of scanning through the code you realize you are in yet another C shop that throws in the occasional stream or hapless user defined class here and there. You quickly realize that not only aren't you going to learn anything new but it is...

Are there any tools that are able to do cyclomatics on Pro*C++ sources?

Are there any tools that are able to do code metrics on Pro*C++ sources? I haven't been able to find anything specific via Google. Does anyone have any experience with this? Thanks. ...

Small open source Unicode library for C/C++

Does anyone know of a great small open source Unicode handling library for C or C++? I've looked at ICU, but it seems way too big. I need the library to support: all the normal encodings normalization finding character types - finding if a character should be allowed in identifiers and comments validation - recognizing nonsense ...

C++ pointer casting issue

I need to pass a pointer through a scripting language which just has a double and string type, for this I only have to worry about 32-bit pointers. Seeing as the pointers are 32-bit, I figured doubles had enough precision to safely store the pointer, which works, however the problem arises with some pointers to stream, presumably due to...

How to send an email with C++

I'm making a program that supports email functionality within a web browser. I want it to be able to email people and I'm trying to find out how I can accomplish this using C++. Could someone please help? ...

C++ syntax question

Hi, What does the following syntax mean? typedef void* hMyClass; //typedef as a handle or reference hMyClass f = &something; const MyClass& foo = static_cast<MyClass&>(*f); foo.bar(); ...

How can I implement metaclasses in C++?

I've been reading a bit about what metaclasses are, but I would like to know if they can be achieved in C++. I know that Qt library is using MetaObjects, but it uses an extension of C++ to achieve it. I want to know if it is possible directly in C++. Thanks. ...

Issues with C++ 'new' operator?

I've recently come across this rant. I don't quite understand a few of the points mentioned in the article: The author mentions the small annoyance of delete vs delete[], but seems to argue that it is actually necessary (for the compiler), without ever offering a solution. Did I miss something? In the section 'Specialized allocators',...

Difference between references and pointers

duplicate: Difference between pointer variable and reference variable in C++ What does Class& mean in c++ and how is it different from Class*? Class& foo; Class* foo; ...

Reading an input file in C++

I would like to read an input file in C++, for which the structure (or lack of) would be something like a series of lines with text = number, such as input1 = 10 input2 = 4 set1 = 1.2 set2 = 1.e3 I want to get the number out of the line, and throw the rest away. Numbers can be either integers or doubles, but I know when they are one o...

glDrawPixels in grayscale?

I have an image that I'm rendering like this: glDrawPixels(image->width, image->height, GL_BGR, GL_UNSIGNED_BYTE, image->imageData); Is there anyway I can draw it in grayscale instead (without loading it into a texture first)? I don't care if only, say, the blue component is used for the gray value rather than the L2 norm or something...

How to get Words length and height, when drawing the images on a canvas in GDI+

I draw a string on a canvas, using GDI+ in C++. Is there any API to get the out layer (width, height ) of a string in a certain font? Thanks very much! Many thanks to Windows programmer's solution. I wrote the following code. Bitmap bitmap(1000,1000); Graphics graphics(&bitmap); RectF rec; RectF useless; graphics.MeasureString(m_sW...

Copy constructors - c++

Can I write a copy constructor by just passing in a pointer instead of the const reference? (Would it be ok if I make sure that I am not going to change any values though?) Like so: SampleClass::SampleClass(SampleClass* p) { //do the necessary copy functionality } instead of: SampleClass::SampleClass(const SampleClass& copyObj) {...

How do you build a debug .exe (MSVCRTD.lib) against a release built lib (MSVCRT.lib)?

I'm using Visual C++ 2008, SP1. I have a QT app (gui, .exe) in debug build config. It's set to use the Multi-threaded Debug DLL version of the CRT, aka MSVCRTD.lib. I'm linking against a 3rd party library that is built in release mode and using the Multi-threaded DLL (non-debug) version of the CRT, aka MSVCRT.lib. It links and runs but...

Which is the best c++ web framework?

Just curious, are there c++ frameworks out there which resemble django-python , symphony-php, or spring-java? Gath ...