c++

What is the most efficient thread-safe C++ logger?

I am working on a performance critical multi-threaded application. I looked at rlog, Ace and Boost logging. I chose rlog because I read it was the fastest (when logging is disabled, it has the least overhead). The problem I have is it shows the file name, line number etc. even in release mode. If you can tell me how to shut that informa...

Cannot execute program if using boost (C++) libraries in debug-version on WinXP

I'm using boost for several C++ projects. I recently made a upgrade (1.33.1 to 1.36, soon to 1.37), since then I cannot run any debug-builds anymore. To be sure that no other project issues remain, I've created a minimum test-project, which only includes boost.thread, and uses it to start one method. The release build can be started, ...

UTF-8 From File to TextBox VC++ 6.0

How do I get an old VC++ 6.0 MFC program to read and display UTF8 in a TextBox or MessageBox? Preferably without breaking any of the file reading and displaying that is currently written in there (fairly substantial). I read a line into CString strStr, then used this code: int nLengthNeeded = MultiByteToWideChar(CP_UTF8,0,strStr,1024,...

Database Access Libraries for C++

Background: I have an application written in native C++ which uses the wxWidgets toolkit's wxODBC database access library which is being removed from all future versions of wxWidgets . I need to replace this with another database access method that supports the assumptions and contraints outlined below. I don't require that the replacem...

How do I create a random alpha-numeric string in C++?

I'd like to create a random string, consisting of alpha-numeric characters. I want to be able to be specify the length of the string. How do I do this in C++? ...

C++: Dll compatibility between compilers

Is there some way to make c++ dlls built with diffrent compilers compatible with each other? The classes can have factory methods for creation and destruction, so each compiler can use its own new/delete (since diffrent runtimes have there own heaps). I tried the following code but it crashed on the first member method: interface.h #p...

Doubt in C++ file handling

Following code, when compiled and run with g++, prints '1' twice, whereas I expect '1' to be printed only once, since I am dumping a single structure to the file, but while reading back it seems to be reading two structures. Why? #include <iostream.h> #include <fstream.h> int main(){ struct student { int rollNo; }; ...

How do I create a strong password string in C++?

Would like to create a strong password in C++. Any suggestions? I assume it should use alpha (upper and lower), numeric, special characters. It would be good to be able to specify a minimum length. It would be great to avoid characters that are hard to visually distinguish like "O" and "O" It would be great to void all characters same,...

How to debug a Visual C++ Runtime Error

I am writing a C++ COM object in Visual Studio 2008 that is an Internet Explorer Browser Helper Object. Recently, when running in IE, IE has started frequently popping up a dialog titled "Microsoft Visual C++ Runtime Library" with an error message "Runtime Error!" and going on to say that "The application has requested the Runtime to ter...

Building Boost BCP

I was trying to build Boost C++ Libraries for last two hours and stopped without any result. Since I am new to C++, I am unable to get the build right. How can I build it correctly using Visual Studio 2008? I need to use the BCP tool to extract a subset of library. So I need to build BCP first, right? How to do this? When I tried to bui...

for(;true;) different from while(true)?

If my understanding is correct, they do exactly the same thing. Why would anyone use for the "for" variant? Is it just taste? Edit: I suppose I was also thinking of for (;;). ...

Crash writing simple WSO2/C++ web service client

Has any been able to successfully run with a client using the WSO2/C++ web services package? I've tried just about everything I can think of yet every time I try to run a very simple client I get a crash. Here's some sample code from one of their example programs... #include <stdio.h> #include <WSRESTClient.h> #include <OMElement.h> #...

c++ push_back, non const copy constructor

I have a class that i want to push_back into a deque. The problem is when i push back i need the original object to be changed thus i need a non const copy ctor. Now if i implement that my const copy ctor gets called. If i removed the const ctor i get an compile error about no available ctors. How do i implement this in a way that i can ...

boost lite?

I heard there is a light implementation of boost where its only smart pointers and a few other very basic stuff. I think i heard it doesnt use any OS functions either. I tried searching for it but found nothing. Does anyone know what it is called or an implementation of boost styled smart pointers that doesnt require OS calls? ...

How to compile a simple Qt and c++ application using g++ on mac os x?

I am trying to use Qt for a project in school but am running into problems. I started following the tutorials and I am running into Makefile problems. Most of the tutorials say to run qmake -project, then qmake and finally make. But when I try this I run into the error make: *** No targets specified and no makefile found. Stop. I dont k...

"Proper" way to store binary data with C++/STL

In general, what is the best way of storing binary data in C++? The options, as far as I can tell, pretty much boil down to using strings or vector<char>s. (I'll omit the possibility of char*s and malloc()s since I'm referring specifically to C++). Usually I just use a string, however I'm not sure if there are overheads I'm missing, or ...

make shared_ptr not use delete

in my code i would like boost::shared_ptr not to call delete but call ptr->deleteMe() instead. Also i have a few C styled functions that return a ptr. Can i make it call lib_freeXYZ(ptr); instead of trying to delete? ...

About Memory Management in Java and C++.

Well, I've been given an assignment to basically figure out how memory allocation works for whatever language I'll be using. After some research, I have some questions and doubts which I'd like to get some insight in. For example: I read here that Java specifies exactly how the stack contents are organized. Looking at the JVM spec struc...

Most efficient way to process arguments from the command-line in C++

Suggestions for command-line argument processing in C++ efficiently: Note: Windows specific only 1: #include <iostream.h> 2: int main(int argc, char **argv) Instead of, for example: if ( argc != 3 ) { .... } Regards ...

Scope resolution operator on enums a compiler-specific extension?

On this question, there's an answer that states: You can use typedef to make Colour enumeration type accessible without specifying it's "full name". typedef Sample::Colour Colour; Colour c = Colour::BLUE; That sounds correct to me, but someone down-voted it and left this comment: Using the scope resolution operator :: on enum...