I have experienced a strange behavior when using _itoa_s and _ultoa_s if I try to get a char array from an DWORD. The function returns zero(success) and my application continues, but I'm getting an exception window with error code 0xc0000417 (STATUS_INVALID_CRUNTIME_PARAMETER).
ULONG pid = ProcessHandleToId(hProcess);
int size = getIn...
WPF applications are, at its core, managed applications? Right? So, I have to choose between using managed C++ or managed C#. I experimented with managed C++ years ago. It seemed to be not quite be ready for primetime. I'm guessing Microsoft has put more effort into managed C# than managed C++. So, it seems like using managed C# is...
Hello,
I have a template class which looks like the following:
template <template <class TypeT> class PoolT=pool_base>
struct pool_map
{
public:
template <typename U> struct pool { typedef PoolT<U> type };
public:
template <typename T, size_t S=sizeof(T)>
T& get( size_t index );
private:
pool<uint8_t>::type pool8_;
pool<ui...
I'd want to hear various opinions how to safely use c++ in mission critical realtime applications.
More precisely, it is probably possible to create some macros/templates/class library for safe data manipulation (sealing for overflows, zerodivides produce infinity values or division is possible only for special "nonzero" data types), a...
I have defined the following struct to represent an IPv4 header (up until the options field):
struct IPv4Header
{
// First row in diagram
u_int32 Version:4;
u_int32 InternetHeaderLength:4; // Header length is expressed in units of 32 bits.
u_int32 TypeOfService:8;
u_int32 TotalLength:16;
// Second row in dia...
I have a C++ Application, when I observe Task Manger, it shows that applicaiton's memory usage increases gradually.
I manually check my source code, and I used Visual Leak Detector for Visual C++ to find memory leak, but I couldn't find any.
Is it 100% that there is a memory leak, and I couldn't find it or is there any possibility that ...
I'm learning C++ and can't get my head around this problem:
I have a simple class A
class A {
private:
int ival;
float fval;
public:
A(int i = 0, float f = 0.0) : ival(i), fval(f) { }
~A(){ }
void show() const {
cout << ival << " : " << fval << "\n";
}
void setVal(int i) {
ival = i;
}
...
I have a program A that needs to send commands to the stdin of a program B and reads back the output of this program B. (Programming in C++, not linux only)
ProgramA -> send letter A -> ProgramB
ProgramA <- output of B <- ProgramB
I actually have the first part, send commands to B, working with popen(). I do know that popen is a one wa...
Hi all,
I've developed a driver that is compiled for 32 bits system. The driver is unidriver based.
Does anyone knows what should be needed to get the driver compatible with 64 bits? What changes should I need to do to the code, if any? or is it just a matter of compiling it with a 64 bits version of the DDK?
Thanks in advance.
Nuno
...
Please explain why s1.printVal causes a dangling pointer error. Isn't the s1 object, i.e. its pointer, still accessible until it's destroyed?
class Sample
{
public:
int *ptr;
Sample(int i)
{
ptr = new int(i);
}
~Sample()
{
delete ptr;
}
void PrintVal()
...
Has anybody personally used
AfxEnableMemoryTracking function provided by MFC
to detect memory leaks. How useful is it?
...
I need to write code for a callback function (it will be called from within ATL, but that's not really important):
HRESULT callback( void* myObjectVoid )
{
if( myObjectVoid == 0 ) {
return E_POINTER;
}
CMyClass* myObject = static_cast<CMyClass*>( myObjectVoid );
return myObject->CallMethod();
}
here the void* is...
I can have a typedef function pointer in a class like this:
template<typename T>
class MyClass
{
public:
typedef T (*fptr)(T);
void doSomething(fptr my_fptr) { /*...*/ }
};
and this works fine. but if I inherit from such a class, as below:
template<typename T>
class MyClass
{
public:
typedef T (*fptr)(T);
virtual void doSo...
I'm trying to use boost::iostreams with a zlib filter like this:
std::ostringstream oss;
boost::iostreams::filtering_stream<boost::iostreams::output> out;
out.push(boost::iostreams::zlib_compressor());
out.push(oss);
out << requestXML << std::flush;
to compress a lump of xml in accordance with RFC1951, however I s...
I want to use the recursive_directory_iterator offered by boost::filesystem to delete a directory. But at construction time the debugger stops with the message Signal Received: Sigtrap . I can choose to continue ( have to do it several times because multiple Sigtraps are caught ) and the program will work as expected, but debugging with ...
Hello all,
I was trying the Hello pass example in the "Writing an LLVM Pass" webpage ( http://llvm.org/docs/WritingAnLLVMPass.html#basiccode ). I followed the instructions to compile (with gcc-4.2) the Hello.cpp, but I got the compile errors:
Hello.cpp:20: error: expected identifier before string constant
Hello.cpp:20: error: expect...
Sometimes, when using macros to generate code, it is necessary to create identifiers that have global scope but which aren't really useful for anything outside the immediate context where they are created. For example, suppose it's necessary to compile-time-allocate an array or other indexed resource into chunks of various sizes.
/* P...
What does the letter near the digit constant mean? Just for example:
int number = 0;
float decimal = 2.5f;
number = decimal;
What's difference betweet 2.5f and f2.5 ? I have already looked in manuals, but I really cant understand it. Explaine it me please in a simple format.
...
I am trying to implement an AVL tree for educational purposes but the rotation is not working like I expected.
I have nodes which each have a pointer to a left, right and parent node.
Below is my code for the right-right rotation. First the imput (Just so I make it clear, this is what I understand to be the RR case)
a
\
b
\
...