c++

Using Thrift for PHP to C++ translations

Hey all, I was wondering if anyone had any experience with thrift and could provide an example of taking a PHP array (or object) and translate it into a C++ array (or object). Either that or point me to documentation on how to do this in PHP (which is incomplete on their website!) Thanks! Matt Mueller ...

C/C++ Copy file with automatic recursive folder/directory creation

In Win32 API, there is CopyFile that literally copies a file. However, this API doesn't create folders. For example, I'd like to copy C:\Data\output.txt to D:\Temp\Data\output.txt. But, the target folders, D:\Temp and D:\Temp\Data', do not exist. In this case, this API just fails. Is there a handy API that can automatically and recursiv...

Coming from C to C++

HI all. I have started a new job recently where I am supposed to work with C++/ I have been doing programming in C language for past 5 years. I am looking for ways to get me up to an acceptable level in OOP. I have all the basic concepts of C++ and OOP but don't have much experience of actual class designing. What I really am looking for...

class NSCFNumber autoreleased with no pool in place - just leaking

Hi everyone, I am new to C++ and have just started to work on a project using threading. Currently my project involves the OpenGL and OpenCV libraries, and in the process of coding I encountered the following error : Current language: auto; currently c++ 2009-12-21 14:54:49.438 3DTestApp[3210:7803] *** _NSAutoreleaseNoPool(): Objec...

Get File Last Modify Time and Compare

Hi I want a piece of function which will take a file and last how many days, if it was older than that date, will return 0 otherwise 1... Something like that... For example: int IsOlder(TCHAR *filename, int days) { do operation. If last modify date was older than days variable return 0 else return 1 } It's MS VC++ 6 for Windows. ...

How to convert string (containing double max) to double

I have no problem converting "normal" double values, but I can't convert numeric_limits<double>::max() or DBL_MAX string representations? std::string max = "1.79769313486232e+308"; std::istringstream stream(max); double value; // enters here, failbit is set if (!(stream >> value)) ...

How to organize sources of complex program?

We're creating very complex embedded system and «sources» contains few projects of Visual C++, IAR, Code Composer Studio and Altium Designer schemes and pcbs. All of that possibly could be in few versions. So, what practice could you advice me to arrange all that stuff? Thank you ...

Wide to narrow characters

What is the cleanest way of converting a std::wstring into a std::string? I have used W2A et al macros in the past, but I have never liked them. ...

overloading operator delete, or how to kill a cat?

I am experimenting with overloading operator delete, so that I can return a plain pointer to those who don't wish to work with smart pointers, and yet be able to control when the object is deleted. I define a class Cat that is constructed with several souls, has an overloaded operator delete that does nothing, and destructor that decrem...

`using` statement across two DLLs

I have a class defined in one DLL, with a certain member that is overloaded. A second DLL imports that class, inherits from it and exports the inherited class. The inherited class overrides one of the overloads of the above member, and so looses all the other overloads. The solution for this problem generally, AFAIK, is to use a using s...

Linkage problem when using Poco C++ 1.3.6 for iPhone Xcode project

I managed to compile Poco C++ 1.3.6 library for iPhone by the following commands: ./configure --config=iPhone --no-tests --omit=Data,Cryptor,NetSSL_OpenSSL ./make Then I created a new view-based Application for iPhone and add Header search paths and changed my .m file to .mm. And then I added the newly compiled .a files into my Xcode ...

Storing a Type as a Variable? for a templated class?

Hi, i have a templated class, with the following definition: ImageRescaleDepth<PIXEL_TYPE_INPUT, PIXEL_TYPE_OUTPUT> This class uses templates, for pretty much everything since its supposed to be generic. Anyways i need to make a command line version of this application, to do image rescaling, currently the system is setup to handle th...

Storing a lua class with parent in luabind::object (updated)

Using C++, lua 5.1, luabind 0.7-0.81 Trying to create a lua class with parent and store it in a luabind::object. Lua class 'TestClassParent' function TestClassParent:__init() print('parent init\n') end function TestClassParent:__finalize() print('parent finalize\n') end class 'TestClass' (TestClassParent) function TestCla...

How do I make an unreferenced object load in C++?

I have a .cpp file (let's call it statinit.cpp) compiled and linked into my executable using gcc. My main() function is not in statinit.cpp. statinit.cpp has some static initializations that I need running. However, I never explicitly reference anything from statinit.cpp in my main(), or in anything referenced by it. What happens (I sup...

How to find a value exists in a C++ std::map

Hi, I'm trying to check if value is in a map and somewhat can't do it: typedef map<string,string>::iterator mi; map<string, string> m; m.insert(make_pair("f","++--")); pair<mi,mi> p = m.equal_range("f");//I'm not sure if equal_range does what I want cout << p.first;//I'm getting error here so how can I print what is in...

DDD debugger: save A command history between sessions

I noticed that my command history remains only during the current session, and once I re-start ddd, say with the same process, it starts with a clean slate. Is there way I can force the latest history to persist/reload. I couldn't find any relevant options in Edit-> Preference/GDB sessions. I am using GNU DDD 3.3.9 (i386-redhat-linux...

Dynamically inserting strings to a std::map

Hi I am trying to create a map of file pairs... First I am searching a specified directory for files using the FindFirstFile and FindNextFile and when a file is found I search the map to see if the associated file is there. If the other file was added to the map, the new found file is inserted beside the previously found one. If an asso...

Calling Excel/DLL/XLL functions from C#

Hello, I have a particular function in an Excel addin(xll). The addin is proprietary and we do not have access to the source code. However we need to call some functions contained within the addin and we would like to call it from a C# program. Currently, I was thinking of writing a C++ interface calling the Excel function with xlopers,...

Which IDE should I use for this art project?

I have an art project that will require processing a live video feed to use as the basis of a particle system, which will be rendered using OpenGL and projected on a stage. I have a CUDA enabled graphics card, and I was thinking it would be nice to be able to use that for the image and particle system processing. This project only needs...

Binary files and cross platform compatability

I have written a C++ library that saves my data (a collection of custom structs etc) into a binary file. I currently use (i.e. CREATE and CONSUME) the files locally, on my Windows (XP) machine. For simplicity, lets think of the library in two parts: a WRITER (Creates the files) and a READER or CONSUMER (simply reads data from the files)....