I have enjoyed learning to use OpenGL under the context of games programming, and I have experimented with creating small shapes. I'm wondering if there are any resources or apps that will generate code similar to the following with a simple paint-like interface.
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_LINE_STRIP);
glVertex2f(1, 0);
glVert...
This is a followup to http://stackoverflow.com/questions/2050900/c-templates-prevent-instantiation-of-base-template
I use templates to achieve function overloading without the mess of implicit type conversions: declare the function template, define desired specializations (overloads). all is well except wrong code does not produce erro...
Consider the class:
MyClass {
int varA;
int varB;
};
I have a vector of pointers to MyClass objects:
std::vector<MyClass*> Vec;
I want to sort the vector according to varA or varB using the same sort function, i.e. :
bool SortFunction(const MyClass* obj1, const MyClass* obj2, const short type) {
if( type == VARA_ID )
...
Hi all,
I'm trying to decrypt a file in unmanaged C++ that was previously encrypted with C# TripleDESCryptoServiceProvider. Unfortunately I do not have a clue how to do that with the Microsoft Crypt API (advapi32.lib). Here is the C# code that I use to encrypt the data:
private static void EncryptData(MemoryStream streamToEncrypt)
{...
I am using Eclipse IDE for C/C++ Developer- Build id: 20090920-1017
We know that eclipse for C++ has built-in 'coding aids' for C/C++ developers:
1) Code completion -
Automatically complete/fill method names or fields names of a class or structure.
Automatically populate class structures, for loops et al
2)Templates
You can create and...
I am attempting to get xincludes working in an existing system that uses a XercesDOMParser in xercesc to parse incoming xml from a client. I am working with Apache Xercesc v3.0.1, and the incoming XML, read from an input stream, is:
<?xml version="1.0" encoding="UTF-8"?>
<VisionServer xmlns:xi="http://www.w3.org/2001/XInclude">
...
Hi I'm making an app using GTKMM. The screenshot is below:
Screenshot
The Problem is, I'm not able to position the "My Label" to align at the top, just below the Search box.
I'm packing Name,Search box, Search Button into a HBox, which is packed into a VBox, and then MyLabel is packed into the VBox.
I think the problem is that the V...
I have a bit of problem with this. I have a class A which instantiates an object of B and then B which instantiates an object of A. Is this at all possible? I tried adding this in the headers of each
#ifndef A
#define A
class a...
#endif
but if keeps me in an infinite header loop which it reaches the maximum header includes, so obvi...
The pointer of derived class returned by new can be type cast to the pointer of its base class.
Is this true or false?
I know dynamic_cast can be used to cast downside. Generally, how to cast a pointer of derived class to a pointer of its base class?
...
Hi.
I often see the following function declaration:
some_func(const unsigned char * const buffer)
{
}
Any idea why the const is repeated before the pointer name?
Thanks.
...
I have a project which has the following directory structure.
root
--include
----module1
----module2
--src
----module1
----module2
So a file say foo.cpp in src/module1 has to include like,
#include "../../include/module1/foo.hpp"
This looks messy and tough to write. I found writing include like
#include <module1/foo.h>
and provi...
I've been messing around with getaddrinfo and getnameinfo but the closest I got to useful output was "localhost.localdomain". I'm not sure what to pass in for the "node" or "service" args of getaddrinfo, although I think it's the function I want.
...
hi, i am using an mfc ListCtrl, is there anyway to know if a selection change was caused by mouse/keyboard input rather than a programatic change? i am after the same behaviour as ON_LBN_SELCHANGE for a listbox. thanks
...
I'm looking at this bit of text in the documentation for Visual C++'s _ReadWriteBarrier intrinsic:
In past versions of the Visual C++
compiler, the _ReadWriteBarrier and
_WriteBarrier functions were enforced only locally and did not affect
functions up the call tree. In Visual
C++ 2005 and later, these functions
are enforce...
I'm having an issue with a program I'm working on in C++. I am asking the user to input a valid number. I take it in as a string because the particular assignment I'm doing, it makes it easier in the long run. For basic error checking, I want to check to see if the number entered is a valid number. Example:
Enter number: 3.14
This would...
We always declare a pure virtual function as :
virtual void fun () = 0 ;
i.e. it is always assigned to 0.
What I understand is that this is to initialize the vtable entry for this function to NULL and any other value here results in a compile time error. Please tell me whether this understanding is correct or not.
...
Hi,
In my application, I need direct access to the _environ variable because I must have something like the glibc unsetenv (you cannot have that with setenv or putenv).
This is the code I need to use:
//////////////////////
// unsetenv for WIN32, taken from libc source
int unsetenv(const char *name)
{
size_t len;
char **ep;
if ...
Hello.
I have a very strange problem related to debugging of self-coded DLLs. I have an MFC-driven dialog-based application, several projects linked statically and several DLL-projects which are loaded at runtime.
I build solution in debug, run the application and I can easily debug those DLL-projects. Now the problem. If there is some...
Hi - I have a class and in the class constructor I want to check few paramters that have been passed, if any parameter fails the check, I want to prevent the class from initialisation. How can I do that ?
Class MyClass
{
MyClass(int no);
};
MyClass::MyClass(int no)
{
if(no<0) // Prevent the Class from Initialisation
}
void main()
{
...
In C++, in what case, the derived class must have its own constructor?
what about the three cases: 1) public inheritance; 2) private inheritance; 3) protected inheritance;
Thanks a lot.
...