After finishing my C++ class it seemed to me the structs/classes are virtually identical except with a few minor differences.
I've never programmed in C before; but I do know that it has structs. In C is it possible to inherit other structs and set a modifier of public/private?
If you can do this in regular C why in the world do we nee...
I understand that this does but what is the difference between *this and this?
Yes I have Googled and read over *this in my text book; but I just don't get it...
...
I have a main function in A.cpp which has the following relevant two lines of code:
B definition(input_file);
definition.Print();
In B.h I have the following relevant lines of code:
class B
{
public:
// Constructors
B(void);
B(const char *filename);
~B(voi...
Hi All,
I've been trying to get Qt working (QCreator, QIde and now VS2008).
I have sorted out a ton of issues already, but I am now faced with the following build errors, and frankly I'm out of ideas.
Error 1 error LNK2019: unresolved external symbol "public: void __thiscall FileVisitor::processFileList(class QStringList)" (?proce...
I need to make a file that contains "name" which is a string -array of char- and "data" which is array of bytes -array of char in C++- but the first problem I faced is how to separate the "name" from the "data"? newline character could work in this case (assuming that I don't have "\n" in the name) but I could have special characters in ...
Different platforms use different line separator schemes (LF, CR-LF, CR, NEL, Unicode LINE SEPARATOR, etc.). C++ (and C) make a lot of this transparent to most programs, by converting '\n' to and from the target platform's native new line encoding. But if your program needs to determine the actual byte sequence used, how could you do i...
I have a fictional class:
template<typename T> class demonstration
{
public:
demonstration(){}
...
T *m_data;
}
At some point in the program's execution, I want to set m_data to a big block of allocated memory and construct an object T there.
At the moment, I've been using this code:
void construct()
{
*m_data ...
I have a function that I am calling that runs all the way up to where it should return but doesn't return. If I cout something for debugging at the very end of the function, it gets displayed but the function does not return.
fetchData is the function I am referring to. It gets called by outputFile. cout displays "done here" but not "da...
I'm using C++ and GDI+
I'm going to be making a vector drawing application and want to use GDI+ for the drawing.
I'v created a simple test to get familiar with it:
case WM_PAINT:
GetCursorPos(&mouse);
GetClientRect(hWnd,&rct);
hdc = BeginPaint(hWnd, &ps);
MemDC = CreateCompatibleDC(hdc);
bmp = C...
hello.
Is it possible to specify alignment of parent class?
for example something like (which does not compiled):
template<size_t n>
class Vector : public boost::array<double,n> __attribute__ ((aligned(16)))
{
thanks
well, from comments I gather this is no good way to go.
I think I will just stick to composition/alignment of private...
The question is simply in the title, if I have a function I want to use via a g_timeout_add(), but this function is a class member function, is there any way I can use it with g_timeout_add()?
...
Consider the below 2 declarations.
* appears next to the datatype and not next to variable
char* ptr1, * ptr2, * ptr3; //all 3 are pointers
* appears next to the variable and not next to datatype
char *ptr1,*ptr2,*ptr3; //again all 3 are pointers
Is there any difference in intepretation between the 2 declarations. I know there is ...
I was reading some c++ code, and i saw something interesting.
The code was something like this:
repeat:
...code here....
fallback:
...code here....
start:
....another code....
This is the first time i am seeing this kind of "labels" in c++ code, i called the labels cos i have seen something similar in assembly code w...
I'm trying to create a program which reads an image in (starting with bitmaps because they're the easiest), searches through the image for a particular parameter (i.e. one pixel of (255, 0, 0) followed by one of (0, 0, 255)) and changes the pixels in some way (only within the program, not saving to the original file.) and then displays i...
Consider the below example
int nCount[2] = {5,10};
int* ptrInt;
ptrInt = nCount;
cout<<ptrInt<<Endl;//this will print the address of arrar nCount
now consider this
char *str = "Idle mind is a devil's workshop";
int nLen = strlen(str);
char* ptr;
ptr = new char[nLen+1];
strcpy(ptr,str);
cout<<ptr<<endl;//this wil print the string
...
I want to use OpenGL in my WndProc but I'm not sure how. I also don't want GL to occupy the whole screen, just a portion of the screen. In the end I basically want to make a drawing win32 app but use OGL instead of GDI. so how can I tell GL to use my control (a panel) 's hdc for drawing?
Thanks
...
I have a question similar to This one .
But I want to implement this in Linux, using ACE framework. What is the way to do this
...
How would I unroll the following nested loops?
for(k = begin; k != end; ++k) {
for(j = 0; j < Emax; ++j) {
for(i = 0; i < N; ++i) {
if (j >= E[i]) continue;
array[k] += foo(i, tr[k][i], ex[j][i]);
}
}
}
I tried the following, but my output isn't the same, and it should be:
for(k = begin; k != end; ++k) {
for(j = 0; j <...
Is OpenGL, given a series of points, able to fill in a polygon or is this only possible by creating lots of trianges?
Thanks
...
I basically want to debug a cgi programm with gdb by emulating the environment variables and stdin stream.
How do I set the variables and stdin?
I am using lampp and gdb.
Thanks!
...