c++

Write file without system and hdd cache.

How can I write something to a file in C++ without using system cache and drive cache? I just want to write exactly on the hdd regardless all the system cache settings. ...

Controlling FPU behavior in an OpenMP program?

I have a large C++ program that modifies the FPU control word (using _controlfp()). It unmasks some FPU exceptions and installs a SEHTranslator to produce typed C++ exceptions. I am using VC++ 9.0. I would like to use OpenMP (v.2.0) to parallelize some of our computational loops. I've already successfully applied it to one, but the n...

Why doesn't boost::serialization check for tag names in XML archives?

I'm starting to use boost::serialization on XML archives. I can produce and read data, but when I hand-modify the XML and interchange two tags, it "fails to fail" (i.e. it proceeds happily). Here's a small, self-complete example showing what I see: #include <iostream> #include <fstream> #include <boost/archive/xml_oarchive.hpp> #includ...

Parameters with and without arguments in boost::program_options

I wrote a small app that uses boost::program_options for command-line parsing. I'd like to have some options that set a value if the argument is present, and alternately prints the current value if the parameter is given but no argument is present. So "set-mode" would look like: dc-ctl --brightness 15 and "get mode" would be: dc-ctl ...

What data-structure should I use to create my own "BigInteger" class?

As an optional assignment, I'm thinking about writing my own implementation of the BigInteger class, where I will provide my own methods for addition, subtraction, multiplication, etc. This will be for arbitrarily long integer numbers, even hundreds of digits long. While doing the math on these numbers, digit by digit isn't hard, wha...

Visual C++ GUI Problems when trying to integrate existing C++ Code

I have a fully functioning classes and functions for a program I need to build. I'm using Visual C++ to put together the GUI, and use the existing classes and functions in the event handlers of the GUI to manage the program. The problem is I'm having a really hard time putting together the C++ code with the GUI. For some reason even tho...

Game development with Qt: where to look first?

Hi there, So, I'm going to develop my Pac-Man clone with Qt. The problem is that I do not really know where to start. I quickly take a look at the documentation and some demo. I also downloaded some game sources on qt-apps.org. And it seems that there is a lot of ways to develop a game with Qt! In your experience, which part of Qt sho...

default initialization in C++

Hi, I have a question about the default initialization in C++. I was told the non-POD object will be initialized automatically. But I am confused by the code below. Why when I use a pointer, the variable i is initialized to 0, however, when I declare a local variable, it's not. I am using g++ as the compiler. class INT { public: ...

Help me convert C++ structure into C#

Hello, I am completely new to C#, and need help converting a C++ structure to C#. The C++ structure is given as: #define QUE_ADDR_BUF_LENGTH 50 #define QUE_POST_BUF_LENGTH 11 typedef struct { const WCHAR *streetAddress; const WCHAR *city; const WCHAR *state; const WCHAR *country; const WCHAR *postalCode; } QueS...

What does "vtable fixup" mean?

I have heard this term, "vtable fixup", used. What does it mean? I had no success asking Google. I already know what a vtable is so that does not need to be defined. ...

Using regular expressions with C++ on Unix

Hello, I'm familiar with Regex itself, but whenever I try to find any examples or documentation to use regex with Unix computers, I just get tutorials on how to write regex or how to use the .NET specific libraries available for Windows. I've been searching for a while and I can't find any good tutorials on C++ regex on Unix machines. ...

Observer design pattern in C++

Is the observer design pattern already defined in STL (Like the java.util.Observer and java.util.Observable in Java) ? ...

Member-Function Pointers With Default Arguments

I am trying to create a pointer to a member function which has default arguments. When I call through this function pointer, I do not want to specify an argument for the defaulted argument. This is disallowed according to the standard, but I have never before found anything that the standard disallowed that I could not do in some other...

Recordset Update errors when updating sql_variant field

I'm using C++ and ADO to add data to a SQL Server 2005 database. When calling the Recordset Update method for a sql_variant column I'm getting the error DB_E_ERRORSOCCURRED and the error message Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. If the value I'm adding is NU...

Communicating applications without Event hooks.

I want to have my applications communicate to each other. I think something like a server-client model would suit me well, but I was also wondering if there was a different way. I want this way to not involve those windows event hooks. ...

Creation of a Header-Only Library

Hello :) I'd like to package a library I'm working on as a Header-Only library to make it easier for clients to use the library (it's small and there's really no reason to make it a separate translation item). However, I cannot simply put my code in headers because such a location would violate C++'s one definition rule if a project use...

C++ Parse XML Using STD

I'm aware there are several XML libaries out there, but unfortunately, I am unable to use them for a school project I am working on. I have a program that created this XML file. <theKey> <theValue>23432</theValue> </theKey> What I am trying to do is parse out "23432" between the tags. However, there are random tags in the file so ...

what's the difference between opening a file with ios::binary or ios::out or both ?

hello i'm trying to figure out the difference between opening a file like: fstream *fileName*("FILE.dat",ios::binary); or fstream *fileName*("FILE.dat",ios::out); or fstream *fileName*("FILE.dat",ios::binary | ios::out); i found that all of these forms are identical,i.e. in all cases ,the same output on the file is produced usin...

SystemTimeToTzSpecificLocalTime crash on windows xp

The time function in the same code crashes on xp but runs fine on windows 2003 machine. Any ideas? TIME_ZONE_INFORMATION tzi; SYSTEMTIME stStartUTC; SYSTEMTIME stStart; LPCSTR lpszZone; BOOL bStatus; FILETIME* pFT; DWORD dRe...

In C++ what does it mean for a compiler to "inline" a function object?

In the wikipedia article about function objects it says such objects have performance advantages when used with for_each because the compiler can "inline" them. I'm a bit foggy on exactly what this means in this context... or any context I'm embarrassed to say. Thanks for any help! ...