c++

Unicode supported isdigit and isspace function

I have the following code. // mfc.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "mfc.h" #ifdef _DEBUG #define new DEBUG_NEW #endif #include <cctype> #include <string> #include <sstream> #include <tchar.h> #include <iostream> #include <Strsafe.h> #include <algorithm> #include <cmath> #inclu...

Undefined references to functions with C++ template methods

Why am I getting undefined references to the methods in this class when I call them? Will I be forced to include the implementation in the header file or is there another way to do this better? class MathHelper { public: /*! Represents the ratio of the circumference of a circle to its diameter, specified by the const...

Double Pointer question

Greetings all, Please take a look at following code: #include <stdio.h> #include <iostream> using namespace std; typedef struct MyType{ int num1; }; void test(MyType **src) { MyType *ret=new MyType; ret->num1=666; *src=ret; } int main(){ MyType *mSrc; test(&mSrc); printf("%d Address\n",mSrc); printf("%d Value \n",mSrc->num1)...

c++ static library is too big, why?

This is what I'm doing (this is an example, not a real-life syntax): $ svn co http://svn.boost.org/svn/boost/trunk/libs/regex/src regex $ c++ -o regex/*.obj -c regex/*.cpp I have 17 *.obj files in regex. Now I'm trying to create a static library from them: $ ar -r regex.lib regex/*.obj The size of the library is 10Mb. Is it a corre...

boost::ptr_vector and find_if

I have a class: //header file class CMDatabase { class Try; typedef boost::shared_ptr<Try> TryPtr; typedef boost::ptr_vector<Try> TryVector; typedef TryVector::iterator TryVectorIterator; class Try { public: virtual ~Try(); virtual bool equal(CMDatabase::TryPtr mySd) = 0; }; }...

Making C++ COM classes more test-friendly

Our code-base has a lot of COM objects, so typically we'll have something like: //this is the IDL-generated IGetTime interface header #include "gettime.h" //our COM class implementation of IGetTime class CGetTime : public IGetTime { public: CGetTime(CGetTimeCF &factory,...); //COM-specific constructor params /* IUnknown */ ...

Validation For Phone Number and Mobile Number

Hi Friends, I need a c,c++ code for validating a Phone Number(8 Digits- Starting with 2) and Mobile Number(10 Digits- Starts with 9). Also it should not allow to enter any space, special charcter, as well as charcters. Here user can enter either phone number or mobile number. Plese Help in this, Thanks, ...

Virtual methods make the application slower, but can they speed up the linking?

As described in http://stackoverflow.com/questions/449827/virtual-functions-and-performance-c virtual methods may have an impact on performance (extra lookup in vtable, no inlining, ...). But I was wondering, could the use of virtual functions speed up the linking process? Suppose that I have a class X, calling a method of class Y. I...

How to cast an int variable to char in C++?

char a[3]; int x=9; int y=8; a[0]=(char)x; a[1]=(char)y; a[2]='\0'; unsigned char * temp=(unsigned char*)a; but when i am displaying this temp, it's displaying ?8. should display 98. can anyone please help??? ...

Syncronize system clock with UTC time using c uder Window OS

I have UTC time which is coming from UDP, I have a program to calculate Day and Time of UTC, how can I set my system clock at that day and time, kindly give me some direction so that I can make it possible. I am using window OS. ...

Good cross platform functional language for library use in a C++ application?

What are my options in terms of a fast functional language for library use in a cross-platform Qt C++ application? It seems almost all languages (functional or not) have some way of calling C/C++ code in an easy manner. I'd like to go the other way around - write an application in Qt using C++ for stateful business logic, GUIs and stuf...

How to pass a pointer to a member function to a C function?

Possible Duplicate: Using a C++ class member function as a C callback function I'm writing an object-oriented library using a C library (winpcap). I need to pass the callback function that is called when a network packet arrives as a function pointer. I would like to pass a member function pointer to winpcap, to keep my design...

Write permission for char*

Coincise question: Need to be able to modify contents of char* in c++. I have a function which is somewhat like this: char* buffer = (char*)FUNCTION Now I need to modify 'buffer' e.g. do something like this buffer[1] = "h"; Amongst what I have tried is the following: char *string = "Hello World"; char buffer[65]; //I still ne...

Audio plaback on laptop

Hi , I wrote simple audio playback application on c++ via latest DirectX SDK. On PC it working fine (Windows xp, Vista, Windows 7), but when I execute application on laptop it produce only silence. What differnce between audio on PC and laptop? ...

Error: Cannot add two pointers

It gives the error in the title about this piece of code: string DDateTime::date2OracleDate(DATE Date) { string s; s="TO_DATE('" + DateFormat("%d/%m/%Y",Date) + "','dd/MM/YYYY')"; return s; } I don't understand how that is possible, no pointers involved.... EDIT: string DDateTime::DateFormat(string sFormat,DATE Date) { ...

What should the following code do and with explanations.

class A { public: A() { } ~A() { cout << "A Destructor \n" ; } }; class B :public A{ public: B() { } virtual ~B() { cout << "B Destructor \n" ; } }; class C : public B { public: C() { } ~C() { cout << "C Destructor \n"; } }; int main() { A *pointA = new A; A *pointB = new B; A *pointC = new C; ...

Undefined references when compiling a static Qt build on Windows

I'd like to compile a static version of the Qt toolkit on the Windows platform (Windows XP SP3). I downloaded the latest release for Windows and successfully installed it. Then I opened the Qt 4.6.3 Command Prompt from the Start menu and invoked: configure -static -release -nomake examples -nomake demos -fast Configuration executes fin...

Signal - Slot connection inside loop

In my code I am creating new objects of same type inside loop and connecting a signal to object slot. Here is my trial. A * a; QList<A *> aList; int aCounter = 0; while(aCounter < 2) { a = new A; aList.push_back(a); connect(this,SIGNAL(somethingHappened()),aList[aCounter],SLOT(doSometing())); aCounter++; } When somethingH...

Library to manage menus in embedded device for C/C++

I'm looking for a library to manage menus. I'm looking for something which is based on configuration files. It doesn't have to manage keyboard input or display, just the menu logic. What I have in mind something like: //menu.xml <menu> <Start /> <Stop /> <Configuration displayname="Configure System"> <Sound type="tog...

What to do to make application Large Address Aware?

I am currently in process of making our application Large Address Aware. As experience has shown, there are some unexpected gotchas when doing so. I create this post to make a complete list of steps which need to be taken. The development considerations listed in the AMD Large Address Aware guide provide a good starting point, but are b...