Hi,
I am trying to create a unit test framework using CPPUnit for a large code base. I need to be able to test individual modules, all of which are part of a module tree that begins with a specific root module.
Due to a non-technical reason, I cannot touch the production file (my original approach involved adding an ifdef to the root m...
A friend of mine asked for a simple program.
Input: Coordinates of some points, spheres, planes etc. ( from an excel document (strictly) )
Output: A 3D view of the input which the user can move the camera.
The questions is, how can I do that easiest way. I have experience in C++, C#, Flash (AS), Java
...
In C++ we have value type (int, long, float, ...) and reference type (class, struct, ...).
For value type, Array and Vector hold the actual values;
For reference type, Array and Vector only hold the references to these objects;
So when we put reference type into Array and Vector, we need to make sure those objects will exist long enoug...
I'm trying to allow multiple clients to connect to a host using select. Will I have to connect each one, tell them to move to a different port, and then reconnect on a new port? Or will select allow me to connect multiple clients to the same port?
This is the client code:
int rv;
int sockfd, numbytes;
if ((rv = getaddrinfo(hostN...
Hi, I'm looking for a way to redirect stdout to a Gtk::TextView widget in gtkmm. Ideally, I want it to work both on Windows and UNIX-like OSes.
So far, I've tried to redirect stdout to a file, then monitor changes to this file using Glib, like so (highly inspired from the gtkmm examples on gnome.org) :
#include <stdio.h>
#include <fcn...
I have seen instances of __declspec in the code that I am reading. What is it? And when would I need to use this construct?
...
Hello,
Environment: Visual Studio 9, C++ without managed extensions.
I've got a third-party library which exports a fully-specialized template class MyClass<42> defined in MyClass.h. It gets compiled into a helper loader .lib and a .dll file. The .lib file contains compiled code for this specialization, and necessary symbols. The MyCla...
I have a C++ app that uses a Jet database through DAO. Large queries work well up through Vista but lockup under Win7 on a multicore machine. I have tried both jet 3.5 and 4.0. Both fail. I have tried disabling threads in calling prog (my app) - still fails.
...
I have 10 files need to be open for write in sequence. Can I have one fstream to do this? Do I need to do anything special (except flush()) in between each file or just call open(file1, fstream::out | std::ofstream::app) for a each file and close the stream at the end of all 10 files are written.
...
Hello,
I've got a small problem with parsing XML. I cannot get the name of a child node.
Here's my XML code:
<?xml version="1.1" encoding='UTF-8'?>
<SceneObject>
<ParticleSystem>
</ParticleSystem>
</SceneObject>
Here's how I parse the XML file:
SceneObject::SceneObject(const char *_loadFromXMLFile, const char *_childType)
{
xmlNod...
There are a lot of solutions for restricting an application from running twice. Searching by process name, using a named mutex etc. But I all of these methods don't work if I want to restrict my application to the shell session.
A user may have more than login session and shell on windows (right?)? If this is true I want to be able to r...
What is the difference in using the blocking call pop() as compared to,
while(pop_if_present(...))
Which should be preferred over the other? And why?
I am looking for a deeper understanding of the tradeoff between polling yourself as in the case of while(pop_if_present(...)) with respect to letting the system doing it for you. This...
Hi,
Could some please help me with these codes? I am trying to make client and server to communicate asynchronously. I mean both client and server don't wait for each other (e.g. when a server or client reads from recvfrom() and data are not present, it takes the last received one (what I named is backup). Here are the codes:
client
...
Python has a function urljoin that takes two URLs and concatenates them intelligently. Is there a library that provides a similar function in c++?
urljoin documentation: http://docs.python.org/library/urlparse.html
And python example:
urljoin('http://www.cwi.nl/%7Eguido/Python.html', 'FAQ.html') ==> 'http://www.cwi.nl/%7Eguido/FAQ.ht...
I've never used string resources before so I would like to ask, when should I use them and why are they beneficial when I can just define a string?
...
Consider the following:
template <typename T>
class Base {
public:
template <typename U>
class Nested { };
};
template <typename T>
class Derived : public Base<T> {
public:
//How do we typedef of redefine Base<T>::Nested?
using Base<T>::Nested; //This does not work
using Base<T>::template<typename U> Nested; //C...
hello
I have a curious problem and I am brainstorming possible solutions. The problem is such: I have a number of inputs (up to several thousand different ones), which basically differ in two-three arrays (arrays are a different size generaly, from size one up to couple thousand elements long). the functions which process arrays take s...
Make sure you run outside of the IDE. That is key.
-edit- I LOVE SLaks comment. "The amount of misinformation in these answers is staggering." :D
Calm down guys. Pretty much all of you were wrong. I DID make optimizations.
It turns out whatever optimizations I made wasn't good enough.
I ran the code in GCC using gettimeofday (I'll past...
Hi,
I have been reading some of the books by Hoglund and I thought I would have a 'go' at his 'simple debugger'...
Anyway, I have been trying to use the line
hProcess = OpenProcess(PROCESS_ALL_ACCESS | PROCESS_VM_OPERATION, 0, aPID);
Every time I use it on a running process hProcess is being returned as NULL, why is this - the targe...
I think I probably have to use an fstream object but i'm not sure how. Essentially I want to read in a file into a byte buffer, modify it, then rewrite these bytes to a file. So I just need to know how to do byte i/o. Thanks
...