I would like to use interfaces in c++ like in java or in c#. I decided to use purely abstract classes with multiple inheritance, but something is terribly wrong when I specialize the interface:
class Interface
{
public:
virtual int method() = 0;
};
// Default implementation.
class Base: virtual public Interface
{
public:
virtual in...
Hello,
i was wondering how to trace a certain object in VC++6.
It can be done by tracing the unique object ID with "Trace Points",
in more recent versions of visual studio. I still haven't figured
out how to do this in VC++ 6. Maybe you guys can point me in the right direction.
Thanks in advance!
Best regards,
zhengtonic
...
I am running a shell script to execute a c++ application, which measures the performance of an api. i can capture the latency (time taken to return a value for a given set of parameters) of the api, but i also wish to capture the cpu and memory usage alongside at intervals of say 5-10 seconds.
is there a way to do this without effecting...
Sorry if this question seems trivial to many here.
In a C++ code there is something as below:
class Foo
{
public:
static int bands;
...
...
private:
...
...
}//class definition ends
int Foo::bands; //Note: here its not initialized to any value!
Why is the above statement needed again when 'bands' is once declared in...
Hello, I'm developing an application that needs to interact over FTP. For this communication I am currently using C++, Visual Studio and Poco on Windows.
The following line results in a bad_alloc exception...
ftp = new FTPClientSession("127.0.0.1", 21);
So I went down and tried initializing a StreamSocket first, also fails...
Stream...
For some class C:
C* a = new C();
C* b(a); //what does it do?
C* b = a; //is there a difference?
...
I would like to upload a fiel (a picture in my case) in C/C++ using HTTP with libcurl.
It will be great to have a working sample in C/C++ with (optional) the php code for the server side.
...
We are developing a rather large project in C++, where many components require configuration parameters. We would like to use a central place to configure everything (like a registry), preferably with a nice and simple GUI (e.g. like Firefox's about:config) and a simple API.
I am pretty sure this that many applications have this kind o...
[ This isn't Baked Potatoes - For Programmers, but it still might be deemed "not programming related" ]
I've read through some of the recommendations at Can you recommend a good C# windows programming book (for Java developer), but none of those seem to be exactly what I'm looking for (perhaps because it doesn't exist).
Specifically, I...
Hello,
Looking for a simple getline example which works correctly.
I want to input something on the keyboard and assign it to a std::string, allowing for whitespace and tabs. The delimiter is the carriage return.
TIA,
Bert
...
My current class is planning on creating a basic networked game, but we have decided to take on the task of making a C++ server with a C# client. I understand this is probably a difficult task, but I was wondering if there is any advice on making this happen.
I am sorry I do not have any more information than this. We are just getti...
What is the difference between "new" and "malloc" and "calloc" and others in family?
(When) Do I need anything other than "new" ?
Is one of them implemented using any other?
...
As a follow up question related to my question regarding efficient way of storing huffman tree's I was wondering what would be the fastest and most efficient way of searching a binary tree (based on the Huffman coding output) and storing the path taken to a particular node.
This is what I currently have:
Add root node to queue
while q...
Duplicate of: In what cases do I use malloc vs new?
Just re-reading this question:
http://stackoverflow.com/questions/807939/what-is-the-difference-between-new-and-malloc-and-calloc-in-c-closed
I checked the answers but nobody answered the question:
When would I use malloc instead of new?
There are a couple of reasons (I can think ...
Duplicate: http://stackoverflow.com/questions/769097/choosing-a-stl-container
I'm looking for a data structure that acts like a set in that it doesn't allow duplicates to be inserted, but also knows the order in which the items were inserted. It would basically be a combination of a set and list/vector.
I would just use a list/vector a...
It appears to me that C++ does not allow member template specialization in any scope other than namespace and global scope (MS VSC++ Error C3412). But to me it makes sense to specialize a base class's primary member template in the derived class because that is what derived classes do - specialize things in the base class. For instance, ...
Is there a call I can make to new to have it zero out memory like calloc?
...
I have a c++ program that takes input from a linux pipe, and outputs to std::cout for further processing.
Currently my code looks like this:
std::istreambuf_iterator<char> it(std::cin);
std::istreambuf_iterator<char> end;
std::string str(it, end);
//Lots of string manipulation here.
str = str.substr(0, 65535);
std::cout << str << std...
I've seen this pattern used a lot in C & C++.
unsigned int flags = -1; // all bits are true
Is this a good portable way to accomplish this? Or is using 0xffffffff or ~0 better?
...
I am writing a C++ application and would like to request several data files through a HTTP GET request simultaneously, where should I look to get started (needs to be cross-platform).
Run Application
Create a list of URLs { "http://host/file1.txt", "http://host/file2.txt", "http://host/file3.txt"}
Request all the URLs simultaneously ...