I have a small C++ project (~60 classes) that I need a human readable PDF of. I tried using doxygen but the LaTeX code it generates does not compile because it's too deeply nested for the LaTeX compiler.
Before I start creating a PDF or HTML document myself using the XML sources doxygen generates, I wanted to know if anyone of you know...
Is it possible to declare a variable in c++ without instantiating it? I want to do something like this:
Animal a;
if( happyDay() )
a( "puppies" ); //constructor call
else
a( "toads" );
Basially, I just want to declare a outside of the conditional so it gets the right scope.
Is there any way to do this without using pointers ...
Alright, so I just took an introductory class into Computer Science and the school's language choice was Java (I have basic knowledge of concepts like polymorphism, encapsulation, etc..). I want to learn C++ then C (I hear that one should learn C++ first then go to C), and was wondering if C# is a nice transitional language because of th...
In a Windows environment, I don't want two instances of my program running at the same time.
Related
Is using a Mutex to prevent multiple instances of the same program from running safe?
...
I was asked to look at some code for a friend. (I rightly hesitated due to the MFC and lots of bad code, but he won...)
This is a dialog box based application that uses a CAsyncSocket.
The problem manifests in some nonstop debugbreaks and other similar things - there are also problem with an MFC ENSURE() macro - checking the socket ...
Code
static void MyClass::ThreadEntryStatic()
{
//...
}
void MyClass::Begin()
{
CreateThread(..,ThreadEntryStatic,..);
}
In which condition we should use the static in class ?
...
Can we override the Save As dialog of Adobe Photoshop? How we can override? What will be your approach?
Actually I want to pop up my own dialog (which save file on server without asking the target path location) instead of Adobe's Save As dialog.
...
I was trying to erase a range of elements from map based on particular condition. How do I do it using STL algorithms?
Initially I thought of using remove_if but it is not possible as remove_if does not work for associative container.
Is there any "remove_if" equivalent algorithm which works for map ?
As a simple option, I thought of ...
I am using OpenCV and saving as a jpeg using the cvSaveImage function, but I am unable to find the jpeg compression factor used by this.
What's cvSaveImage(...)'s Jpeg Compression factor
How can I pass the compression factor when using cvSaveImage(...)
...
The two functions in openCV cvLoadImage and cvSaveImage accept file path's as arguments.
For example, when saving a image it's cvSaveImage("/tmp/output.jpg", dstIpl) and it writes on the disk.
Is there any way to feed this a buffer already in memory? So instead of a disk write, the output image will be in memory.
I would also like t...
When I use std::string and when char* to manage arrays of chars in C++?
It seems you should use char* if performance(speed) is crucial and you're willing to accept some of a risky business because of the memory management.
Are there other scenarios to consider?
...
Is there any way to get the version and vendor of the compiler used by the user through qmake? What I need is to disable building some targets of my project when g++ 3.x is used and enable them when g++ 4.x is used. Any ideas are welcome.
Update: Most answers targeted the preprocessor. This is something that I want to avoid. I don't wan...
In Windows, is there a tool to monitor the status of process synchronisation objects? ie.
event/mutex : signaled or not signaled
semaphore : count
Better yet, to log which thread did what, eg. "thread #5421 Signal Event - testevt"
...
The numeric_limits traits is supposed to be a general way of obtaining various type infomation, to be able to do things like
template<typename T>
T min(const std::vector<T>& vect)
{
T val = std::numeric_limits<T>::min();
for(int i=0 ; i<vect.size() ; i++)
val = max(T, vect[i]);
return val;
}
The problem is that (...
I use vectors, lists, strings and wstrings obsessively in my code. Are there any catch 22s involved that should make me more interested in using arrays from time to time, chars and wchars instead?
Basically, if working in an environment which supports the standard template library is there any case using the primitive types is actually ...
I've always thought that Python's advantages are code readibility and development speed, but time and memory usage were not as good as those of C++.
These stats struck me really hard.
What does your experience tell you about Python vs C++ time and memory usage?
...
See also: Similar question
The code below is obviously dangerous. The question is: how do you do keep track of the reference to *this?
using namespace boost;
// MyClass Definition
class MyClass {
public:
shared_ptr< OtherClass > createOtherClass() {
return shared_ptr< OtherClass > OtherClass( this ); // baaad
}
MyCl...
I need to add a route into the IP4 routing table on windows xp.
However, the Win32_IP4RouteTable class seems to only be able to query existing routes.
Basically I need the same functionality as:
route ADD 192.168.127.254 MASK 255.255.255.255 192.168.1.10
Is it possible to use WMI to add an entry into the IP4 routing table?
Could I ...
What I am trying to do is use the Detours library to hook into an applications WinSock2 send() and recv() functions (a packet logger).
While it does work for the send() function, it does not, however, work for the recv() function.
Here is my relevant code:
#include <cstdio>
#include <ctime>
#include <fstream>
#include <iomanip>
#inclu...
When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs].
I would prefer to do it in Python, but C or C++ is also fine.
...