How to force std::stringstream operator >> to read an entire string instead of stopping at the first whitespace?
I've got a template class that stores a value read from a text file:
template <typename T>
class ValueContainer
{
protected:
T m_value;
public:
/* ... */
virtual void fromString(std::string & str)
{
std::strings...
Hello,
First of all, excuse me for my poor knowledge on C++. I am a real Beginner!
I am trying to compile one C++ code on MS VS2005. I am getting a linker error as follows for below piece of code:-
In one function(some class method) definition, it has code for memory allocation like:
CDecoderUnit *du = new CDecoderUnit(); //<<error i...
Sorry for my English.
The question: At what value of variable n the following code will cause memory leaks?
That's the code:
int* Bar(int n)
{
if (n == 1)
throw "exception";
return new int[n];
}
void Foo(int n)
{
int *a = Bar(n);
if (n <= 2)
return;
delete[] a;
}
It's clear that if n is 2 there
will be memory le...
A RTP packet consists of a 12-byte RTP header and
subsequent RTP payload
The 3rd and 4th byte of the header contain the
Most-Significant-Byte and Least-Significant-Byte of
the sequence number of the RTP packet
Seq Num= (MSB<<8)+LSB
char pszPacket[12];
...
long lSeq = ???? - How to get the sequence number from a packet?
...
Hi,
I consider an option to use Eclipse as an cross platform IDE for C++ code on Linux and Windows.
Is it possible to set Eclipse to compile code with Visual Studio C++
(don't think it's relevant but Eclipse project files will be created by cmake).
Is it possible to debug from Eclipse application compiled by VS C++ compiler?
Is it po...
Hi,
I am building a DLL that another application would use. I want to store the current state of some data globally in the DLL's memory before returning from the function call so that I could reuse state on the next call to the function.
For doing this, I'm having to save some iterators. I'm using a std::stack to store all other data, ...
I've been playing a big with the DC obtained with CreateDC(L"DISPLAY",NULL,NULL,NULL) and I've been wondering why does windows let you draw on the whole screen that easily, cause I think you could do some pretty evil stuff with that like putting a TIMER at 1ms and drawing a black rectangle on the whole screen every time the timer ticks.
...
I'd like a generic method for retrieving the data from a vector.
I have a the following class and vector:
class myClass
{
public:
myClass(int myX, float myZ, std::string myFoo)
: x ( myX )
, z ( myZ )
, foo ( myFoo )
{
}
myClass()
{
}
int x;
float z;
std::string foo;
} ;
std::...
I have to interdependent dll here that i would like to build without having to build them twice (force build both of them and rebuild them again to allow linking).
Here is an exemple :
**DLL A**
void fooA()
{
fooBB();
}
void fooAA()
{
fooB();
}
**DLL B**
void fooB()
{
fooA();
}
void fooBB()
{
}
Is there a way to build those...
Hello, I am new to QT and have one error I am unable to fix...
I have a bunch of windows (VS2005) static library file (.lib). And I am testing if they work well with QT. So I took the most simple library that I have. (Called "MessageBuffer").
So I added MessageBuffer.h to the main.cpp, and added the location of thoses file in the INCLU...
I would like to copy a relatively short sequence of memory (less than 1 KB, typically 2-200 bytes) in a time critical function. The best code for this on CPU side seems to be rep movsd. However I somehow cannot make my compiler to generate this code. I hoped (and I vaguely remember seeing so) using memcpy would do this using compiler bui...
Hi,
I just took some older code of a file reader that had been developed under Linux and tried to use that very same code in my Windows project compiled with MSVC++7.1. The code compiled without any problems, but the file seemed to be empty according to the file reader on Windows.
I tracked the problem down to ifstream.readsome() that ...
I'm using Visual Studio 2008 (C++) and would like to produce a list of all classes that are defined in that project. Does anyone know tools that extract those easily?
A simple 'Find in files' will not be sufficient, of course.
Edit: The list of classes should be created automatically and the result should be a simple file of class name...
I have a few large projects I am working on in my new place of work, which have a complicated set of statically linked library dependencies between them.
The libs number around 40-50 and it's really hard to determine what the structure was initially meant to be, there isn't clear documentation on the full dependency map.
What tools w...
How does an inline function differ from a preprocessor macro?
...
I am using a DataGridView with a DataTable as a stack for some values. Something gets recorded into the DataTable rows and then I send them somewhere in a FIFO fashion - it would be very nice to draw the rows in a bottom->up(to stack them up) direction instead of a up->down direction.
How can I achieve this since the paint events are on...
I want to write an application that can access a table in the database. I took QSqlTableModel as model component for the table.
The problem with the QTableView is that it seems to have no method that returns the currently selected record in the table so i took the QTableWidget class which interhits QTableView.
But when i try to set the...
There are many libraries that manage the wiimote but I am looking for the "best" one, or at least that has the following features:
open-source
portable (at least Win32 and Linux)
written and usable in c or c++
good coverage of wiimote devices
I rely on people that already used such library. Google is good source of information but it...
Problem: I have a large Visual C++ project that I'm trying to migrate to Visual Studio 2010. It's a huge mix of stuff from various sources and of various ages. I'm getting problems because something is including both winsock.h and winsock2.h.
Question: What tools and techniques are there for displaying the #include hierarchy for a Vis...
Currently ive got some reference counted classes using the following:
class RefCounted
{
public:
void IncRef()
{
++refCnt;
}
void DecRef()
{
if(!--refCnt)delete this;
}
protected:
RefCounted():refCnt(0){}
private:
unsigned refCnt;
//not implemented
RefCounted(RefCounted&);
RefC...