INTRODUCTION
Hi,
I am very new to C++, is my 1st statement.
I have started initially with VC++ 2008 Express, I've notice that GCC becomes kind of standard so I am trying to make the right steps event from the beginning.
I have written a piece of code that connects to MSSQL Server via ADO, on VC++ it's working like a charm by importin...
I'm told to create template of function , that will take 4 arguments :
pointer
reference
pointer to array
pointer to function
How to perform this task ? I was trying :
#include <iostream>
using namespace std;
int nothing(int a)
{
return a;
}
template<typename T> T func(int *L, int &M, char *K, int (*P)(int))
{
cout << L <<...
Hi all,
I've got a strange problem with a static variable that is obviously not initialized as it should be.
I have a huge project that runs with Windows and Linux. As the Linux developer doesn't have this problem I would suggest that this is some kind of wired Visual Studio stuff.
Header file
class MyClass
{
// some other stuff he...
Hello All,
I'm using BoundsChecker9.1 with visual c++. I have a class
class Sample{
public:
vector<AnotherClass> x;
};
When I run my program the BoundsChecker tool reports all push_back() calls such as S.x.push_back(AnotherClass()) as memory leak.. Wouldn't all the elements in vector x will always be deallocated when the Sample clas...
how does large text file viewer work?
I'm assuming that:
Threading is used to handle the file
The TextBox is updated line by line
Effective memory handling is used
Are these assumptions correct? if someone were to develop their own, what are the mustsand don'ts?
I'm looking to implement one using a DataGrid instead of a TextBox
I...
typedef unsigned long long IMSI;
IMSI imsi;
when i am trying to print this using %llu as a format specifier, i am getting a rather unrelated value.
What can i do to remove this problem?
I am also using gcc 4.3.3
I though there might be a problem with the tracing mechanism that i have been using, but i am getting the same problem even...
class CConfFile
{
public:
CConfFile(const std::string &FileName);
~CConfFile();
...
std::string GetString(const std::string &Section, const std::string &Key);
void GetString(const std::string &Section, const std::string &Key, char *Buffer, unsigned int BufferSize);
...
}
string CConfFi...
Hi Guys,
Pretty straight foward question, I have a GtkEntry widget that i want to set to be editable. I know the function i should use is:
gtk_editable_set_editable
But i dont know how to make it take a GtkEntry widget as an arguement
Can anyone help me?
Regards
Paul
UPDATE:
Ok, so here is the code im using:
GtkWidget *TextEnt...
Possible Duplicates:
When to use new and when not to, in C++?
When should I use the new keyword in C++?
It seems like I could program something without ever using the word new, and I would never have to worry about deleting anything either, so why should I ever call it?
From what I understand, it's because I would run out o...
Are there any open source UML tools for Linux which can generate C++ source code?
...
I'm trying to optimize some bit packing and unpacking routines. In order to do the packing I need to calculate the number of bits needed to store integer values. Here is the current code.
if (n == -1) return 32;
if (n == 0) return 1;
int r = 0;
while (n)
{
++r;
n >>= 1;
}
return r;
...
Would it be smart to have a vector in an object with a list of pointers that point to it?
This way when the object is deleted, it could delete all the pointers pointing to it to prevent a null-pointer exception?
...
I'm looking for a HashTable or Dictionary implementation in C++ that has similar functionality to the one in C#? Does the STL contain an object like this and how would I use it?
...
This is for the purpose of a client/server program. The client asks for some data off the server, and receives it. Upon receiving this data from a Boost socket on the client side, I handle this message in a static method called parse_message in a class called client_protocol.
This method, given this specific data, will start a process o...
//cstack.h
# ifndef _STACK_H__
#define _STACK_H__
#include<iostream>
#include<vector>
template< class Type ,int Size = 3>
class cStack
{
Type *m_array;
int m_Top;
int m_Size;
public:
cStack();
cStack(const Type&);
cStack(const cStack<Type,Size> &);
int GetTop()const;
bool Is_Full()const;
bool Is_Empty()const...
How do I setup/register a callback function, in C++, to call a function when there is data to be read from a queue?
Edit 1:
Using Neil's answer for a complete answer (in header file):
#include <vector.h>
class QueueListener {
public:
virtual void DataReady(class MyQueue *q) = 0;
virtual ~QueueListener() {}
};
class...
I am developing game editor in C# that uses c++ lib files.
I want RTTI for C++ classes in C#.
Is it possible to get RTTI of C++ class in C#?
If yes how?
...
Is there a way to make the compiler create the default constructors even if I provide an explicit constructor of my own?
Sometimes I find them very useful, and find it a waste of time to write e.g. the copy constructor, especially for large classes.
...
I am attempting to create an overloaded unary - operator but can't get the code to compile. A cut-down version of the code is as follows:-
class frag
{
public:
frag myfunc (frag oper1,
frag oper2);
frag myfunc2 (frag oper1,
frag oper2);
friend frag operator + (f...
The problem I am having is with the following
ID3D10Texture2D *pBackBuffer;
hr = mpSwapChain->GetBuffer(0, __uuidof(ID3D10Texture2D), (LPVOID*) &pBackBuffer);
Below is my code...
#include "DX3dApp.h"
bool DX3dApp::Init(HINSTANCE hInstance, int width, int height)
{
mhInst = hInstance;
mWidth = width;
mHeight = height;...