c++

C++ two or more data types in declaration

...

Violation reading location in std::map operator[]

I encountered a problem when running some old code that was handed down to me. It works 99% of the time, but once in a while, I notice it throwing a "Violation reading location" exception. I have a variable number of threads potentially executing this code throughout the lifetime of the process. The low occurrence frequency may be indica...

C++ Parent class calling a child virtual function

I want a pure virtual parent class to call a child implementation of a function like so: class parent { public: void Read() { //read stuff } virtual void Process() = 0; parent() { Read(); Process(); } } class child : public parent { public: virtual void Process() { //process stuff } child...

Debugging Multi-Project (C++) Solutions in Visual Studio 2005

I'm currently developing an application that is comprised of five separate executables that communicate via ActiveMQ. I have a Visual Studio Solution that contains the five executable projects. One of the projects (the launcher.exe) launches the other four projects from their local folders as separate processes. As such, the launcher ...

Is there a LINQ library for C++?

Are there any Platform agnostic (not CLI) movements to get LINQ going for C++ in some fashion? I mean a great part of server frameworks around the world run on flavors of UNIX and having access to LINQ for C++ on UNIX would probably make lots of people happy! ...

Dynamic Arrays

I'm just starting to learn C++ so excuse me for this simple question. What I'm doing is reading in numbers from a file and then trying to add them to an array. My problem is how do you increase the size of the array? For example I thought might be able to just do: #include <iostream> using namespace std; int main() { double *x; ...

What is the difference between these declarations in C?

Hi friends, I am Manoj here to ask a question again. In C and C++ what do the following declarations do? const int * i; int * const i; const volatile int ip; const int *i; Are any of the above declarations wrong? If not what is the meaning and differences between them? What are the useful uses of above declarations (I mean in whic...

Changes to the C standard for a modern world

Having just answered a question on what the #pragma direction does in C, and had some fun with it, I was thinking of what other useful directives we could add to the language to keep pace with the stresses faced by todays developer. My first one was #dogma, basically there to counteract all the pragmatic stuff creeping into modern C an...

How to make consistent dll binaries across VS versions ?

For instance, winsock libs works great across all versions of the visual studio. But I am having real trouble to provide a consistent binary across all the versions. The dll compiled with VS 2005 won't work when linked to an application written in 2008. I upgraded both 2k5 and 2k8 to SP1, but the results haven't changed much. It works so...

What are underscored symbols in a VB DLL?

I have a C++ app in VS2005 and import a VB DLL. IntelliSense shows me all the symbols in the DLL as expected but it also shows all (or nearly all) of them again with an underscore prefix (no @s in them though). Why is this? What are the differences between the underscored items and the normal items? ...

How can I propagate exceptions between threads?

We have a function which a single thread calls into (we name this the main thread). Within the body of the function we spawn multiple worker threads to do CPU intensive work, wait for all threads to finish, then return the result on the main thread. The result is that the caller can use the function naively, and internally it'll make us...

Is there an acceptable limit for memory leaks?

I've just started experimenting with SDL in C++, and I thought checking for memory leaks regularly may be a good habit to form early on. With this in mind, I've been running my 'Hello world' programs through Valgrind to catch any leaks, and although I've removed everything except the most basic SDL_Init() and SDL_Quit() statements, Val...

How do I print the full value of a long string in gdb?

I want to print the full length of a C-string in GDB. By default it's being abbreviated, how do I force GDB to print the string in full? ...

Monitor battery charge with Win32 API

Hello, I'm trying to write a small app that monitors how much power is left in a notebook battery and I'd like to know which Win32 function I could use to accomplish that. ...

What do you think about c++ after c++0x standard?

What do you think about c++ after c++0x standard is released. ...

ie useragent wxWidgets

Hello, Im currently using ie as an active x com thing on wxWidgets and was wanting to know if there is any easy way to change the user agent that will always work. Atm im changing the header but this only works when i manually load the link (i.e. call setUrl) ...

How can I set the flag FILE_FLAG_BACKUP_SEMANTICS for an fstream object?

How can I set the flag FILE_FLAG_BACKUP_SEMANTICS for an fstream object? You can set most flags with fstream, but it seems like this one is not availble. You can read about the flag here. ...

How can I find the index in a string that matches a boost regex?

How can I find the index in a string that matches a boost regex? ...

Parse a Date from a String in Win32

I have a string containing a date, and another string containing the date format of the first string. Is there a function that I can call to convert that date into something like a SYSTEMTIME structure? Basically, I'd like the opposite of GetDateFormat(). ...

Are pipes considered dangerous to use in Windows, from a security standpoint?

Are pipes considered dangerous to use in Windows, from a security standpoint? ...