I'm using boost::shared_ptr's and boost::dynamic_pointer_cast. I have a base class, an interface that inherits from that base class, and then a class that inherits from that one.
So A -> B -> C. I create an object of type C and it's stored as a shared_ptr of type A. Then I try and do a dynamic_pointer_cast to type B, but boost::dynamic_...
I have a Binary Search Tree as a derived class from a Binary Tree, right now I am trying to access the root for my recursive functions (which is in the base class). But for some reason I keep getting the error:
binSTree.h:31: error: ‘root’ was not declared in this scope
Here are my class declarations:
base class:
template <class T>...
OK. We know the following code cannot be compiled.
char source[1024];
char dest[1024];
// Fail. Use memcpy(dest, source, sizeof(source)); instead.
dest = source;
But, the following code can be compiled and behave correctly.
class A {
char data[1024];
};
A source;
B dest;
dest = source;
I was wondering, in operator assignment fu...
I wrote a simple program to grab stock prices from yahoo finance. The loop that reads the data was truncating early (and ending about where the data from the website shows as opposed to the full download to the correct date for the excell file). So I put in a cout command in the loop to try to debug and voila, it worked correctly! ...
Hi,all:
I create an application by linking the libociei.so and libcustome.so
CC -o main main.cpp ../lib/libociei.so ../lib/libcustome.so
and copy libociei.so libcustome.so to /usr/lib
then I use ldd to check library, it shows:
main .....
libcustome.so ===> /usr/lib/libcustome.so
../lib/libociei.so
why libociei.so is no...
As I code, I try to be security-conscious all the time. The problem is that I need to know what to look for and what to prevent.
Is there a list somewhere of the most common (C++) software vulnerabilities and how to avoid them?
What about C++ software for specific uses, e.g. a linux console software or a web application?
...
i place a QTextEdit widget into a QWidget class(the QTextEdit's parent widget),but when the parent widget show,i clicked the QTextEdit,but it can't gain focus.how this situation comes?
...
hi,
this may be a simple problem, but i am not able to figure it out. I have structure like this.
struct emp
{
int empid;
string fname;
}
emp e[10];
I have some data in e[10].
e[0].empid = 1 , e[0].fname = "tanenbaum"
e[1].empid = 2 , e[1].fname = "knuth"
.....
Now if i have given input command line like this:
emp , empid
...
I have an error (vector iterator incompatibles) during execution in my C++ program that I do not understand. [ (Windows / Visual C++ 2008 Express) ]
Here is a simplified version of my problem :
#include <vector>
class A
{
int mySuperInt;
public:
A(int val) : mySuperInt(val) {}
};
class B
{
std::vector<A*> myAs;
public:...
Where does the pointer returned by calling string::c_str() point to ? In the following code snippet, I thought I will give get a segmentation fault but it gives me the correct output. If the pointer returned by string::c_str() points to an internal location inside the string object, then when the function returns and the object destructo...
Section 7.1 of the C++ Standard mentions about 'extern' as a storage class specifier.
N3126 - "The extern specifier can be
applied only to the names of variables
and functions. The extern specifier
cannot be used in the declaration of
class members or function parameters.
For the linkage of a name declared
with an extern ...
I have the algorithm for void leveltraversal(ostream& out);
but i am not sure how to call it in main () . In my Assignment we are not allowed to change the header file. Is there a way to call it without overloading it?
Update:
void BST::levelTraversal(ostream& out){
queue<BST::BinNode*> q;
BinNode* cur = myRoot;
BinNode* top = NUL...
Hi All,
I want to know how do I exactly call a function from ProjectA::ClassA::FuncA() that is a Win32 .lib with /clr from a ProjectB::ClassB::FuncB() that does not have clr support and is a pure Win32 project.
Both these projects are under same solution.
First, this is what I have tried:
1. Created the ProjectA with the .lib
2. Added t...
Hi, i am unable to use the function MonitorFromPoint in my Qt application. I have the latest Qt SDL 2010.05 with mingw on Windows XP
#include <QtCore/QCoreApplication>
#include<windows.h>
#include <winuser.h>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
POINT pt;
MonitorFromPoint(pt,2);
return a.ex...
In the chapter Filters (scroll down ~50%) in an article about the Remote Call Framework are mentioned 2 ways of compression:
ZLib stateless compression
ZLib stateful compression
What is the difference between those? Is it ZLib-related or are these common compression methods?
While searching I could only find stateful and stateless w...
Hello!
I'm an absolute beginner to programming and i'm just doing some exercises exercises for the beginning.
First of all, i'm using Visual C++ 2010 to compile C-Code. I just create a new project and choose an empty console application. After that, I create a ressource file named test.c and change in the file properties the elementyp...
Hi,
It's my first time trying out C++ STL. I'm trying to build a multidimensional associative array using map. For example:
typedef struct DA {
string read_mode;
string data_type;
void *pValue;
void *pVarMemLoc;
}DA;
int main()
{
map<string, map<string, map<string, map<string, map<string, DA*>>>>> DATA;
...
How can I create two different ip_queues, running at the same time? One of it can listen for incoming packets on one port and another can listen for outgoing packets on the same port.
...
Normally using the same identifier like name of a variable for something like another variable within the same scope generates error by compiler, Is there any technique to actually indicate to compiler that in this scope up to this specific point this name has its own purpose and is used to refer to this variable but after this point the...
hi ,
I want to apply different images to different nodes in my MFC Treeview ?
Currently i have have applied one image to my treeview root node now i want to apply different image to subnodes and how to expand all nodes in treeview , once i expand one node other get collapsed..
Currently i am doing like this :
CImageList *m_pNASIm...