I want to program an emulator ( may be NES or C64, I haven't decided yet ), I know there are lots of them so many may ask why would someone want to make one from scratch, but I want to include some specific characteristics in it, and also for the sake of building it myself.
I'd like to read a guide from someone who has built one and can ...
The C++ Programming Language : Special Edition states on page 431 that...
For every header < X.h > defining part of the C standard library in the global namespace and also in namespace std, there is a header < cX > defining the same names in the std namespace only.
However, when I use C headers in the < cX > style, I don't need to qual...
I'm using Visual Studio 2008.
I have a solution with two projects. One builds a DLL, which is my "production code". The other builds a console app exe, which is my unit test suite.
For my unit test project, I have listed as linker inputs the names of the source modules from the DLL. I.e., I have a DLLMain.cpp in the DLL project, and...
Hello, I'm pretty new to boost. I needed a cross platform low level C++ network API, so I chose asio. Now, I've successfully connected and written to a socket, but since I'm using the asynchronous read/write, I need a way to keep track of the requests (to have some kind of IDs, if you will). I've looked at the documentation/reference, a...
I have source code that was not written by me, and I cannot contact the author. It is written in C++ and requires libjpeg, boost, and the Intel Performance Primitives.
Compilation was a chore, but after days of problem solving, it compiles. Now, I get the following runtime error: error while loading shared libraries: libippi.so.5.1: can...
Hi I'm having problems selecting the correct version of a templated class which has an explicit specialization. I'm wanting to select a specialization using a derived class of the class used to specialize. The scenario is:
#include <stdio.h>
class A
{};
class B: public A
{};
template<typename T>
class Foo
{
public:
int FooBar(vo...
This is the code I have, but the file is a little smaller and doesn't execute:
int WriteFileContentsToNewFile(string inFilename, string outFilename)
{
ifstream infile(inFilename.c_str(), ios::binary);
ofstream outfile(outFilename.c_str(), ios::binary);
string line;
// Initial read
infile >> line;
outfile << line...
I have some code that uses:
__sync_bool_compare_and_swap
it compiles fine on Linux.
But when I try to compile it on MacOSX in g++, I get:
error: ‘__sync_bool_compare_and_swap’ was not declared in this scope
How do I fix this? (This is Mac OSX 10.5.8, so it's intel .. .and should have this instruction).
Thanks!
...
I want to use ActiveMQ as a message broker communicating between a C++ component and a Java component in two process. Eg. C++ component is the publisher and the Java component is the subscriber(there maybe multiple subscribers). I look at ActiveMQ website and it mentions the tool OpenWire and ActiveMQ-CPP. However, all the examples on th...
I am developing an application that uses the GStreamer library. In order to ease deployment I would like to collect all the GStreamer libraries in a local bundle. For this I wrote a little script that does the following:
recursively traverse dependencies (using otool -L)
copy all dependencies to a local directory
make all the dependenc...
std::stringstream convertor("Tom Scott 25");
std::string name;
int age;
convertor >> name >> age;
if(convertor.fail())
{
// it fails of course
}
I'd like to extract two or more words to one string variable. So far I've read, it seems that it is not possible. If so, how else to do it? I'd like name to get all characters before ...
Hi,
i have code written in c++. its a console app that takes an input and displays output. Now i can just give my a.out to someone without giving them the code and it should work on another unix system. but what if they have windows environment. I would like to learn how to make dll for them so they can run that.
also, if they were go...
I have a basic C++ applicatin build using g++ and -framework ...
when I run it, I get a :
Working in unbundled mode. You should build a .app wrapper for your Mac OS X applications.
(which is not std::couted by any of my application).
What causes this, and how can I get rid of it?
Thanks!
...
I understand the semantics of the 2 operations ,
assign- erases before replacing with supplied values.
insert - inserts values at specified location(allocates new memory if necessary).
Apart from this is there any reason to preffer one over the other?
Or to put it another way, is there any reason to use assign instead of insert.
...
I have heard of a limitation in VC++ (not sure which version) on the number of nested if statements (somewhere in the ballpark of 300). The code was of the form:
if (a) ...
else if (b) ...
else if (c) ...
...
I was surprised to find out there is a limit to this sort of thing, and that the limit is so small. I'm not looking for comme...
Just need to set the lbl.caption (inside a loop) but the problem is bigger than i thought. I've tried even with vector of wstrings but there is no such thing. I've read some pages, tried some functions like WideString(), UnicodeString(), i know i can't and shouldn't turn off Unicode in C++Builder 2010.
std::vector <std::string> myStrin...
Here some C++ code that is accessed from multiple threads in parallel. It has a critical section:
lock.Acquire();
current_id = shared_id;
// small amounts of other code
shared_id = (shared_id + 1) % max_id;
lock.Release();
// do something with current_id
The class of the lock variable is wrapper around the POSIX mutex implementation. ...
I have a Copy Hook Handler shell extension that I'm trying to install on Windows 7 64-bit.
The shell extension DLL is compiled in two separate versions for 32-bit and 64-bit Windows.
The DLL implements DLLRegisterServer which adds the necessary registry entries.
After adding the registry entries, it calls the following line of code to...
In my quest to learn C++, I have come across dynamic and static libraries.
I generally get the gist of them: compiled code to include into other programs.
However, I would like to know a few things about them:
Is writing them any different than a normal C++ program, minus the main() function?
How does the compiled program get to be a...
Is there any performance benefit (particularly in C++ or Java) in keeping the size of try block small [aside from it being more informative to the reader as to which statement can throw].
Given the following method where i do not want to throw out of the method.
void function() throws Exception
{
statement1
statement2
state...