So, I have a list of base class pointers:
list<Base*> stuff;
Then, at some point one of the objects will look through all other objects.
Base * obj = ...; // A pointer from the 'stuff'-list.
for (list<Base*>::iterator it = stuff.begin(); it != stuff.end(); it++)
{
if (obj == *it)
continue;
// Problem scenario is here...
I have an external program which takes in a few arguments (PrintLabel) which is called from my application using ShellExecute. PrintLabel is shown below. Sometimes it can take upwards to 15 to 20 seconds to print a label. It seems to get worse over time. If the PC is rebooted, then the printing speeds up again but it gets slower over tim...
Hi ,
i got to do a task that is to find out process /exe/application running in the background.
ie:the process is running but do not have any UI/ Window visible although its an windows GUI application . i thot of reading EXEheader. The header contains a field called 'Subsystem'and application is to run under and the type of interface it...
How to create iterator/s for 2d vector (a vector of vectors)?
...
I am trying to compile the following very very simple piece of source code:
#include <cstring>
// #include <string.h>
// using namespace std;
class Helper {
public:
int cStringsAreEqual(const char *s1, const char *s2) {
return stricmp(s1, s2);
}
};
... but I am getting the following error message:
g++ error: ‘stri...
I need to mess around with the stacks on these architecture and am really a n00b here. Any pointers to reading topics/google searches that i can do. I am looking for how these architectures are fundamentally different from each other. something more than the wikipedia article on this topic http://en.wikipedia.org/wiki/X64
...
Hi,
I'm working through "Developer's Workshop to COM and ATL 3.0" by Andrew W. Troelsen.
I'm trying to implement the lab in Chapter 3.
It shows you how to build a COM client to connect to an inprocess COM server that was developed in an earlier lab.
When I run the client, I receive the error "Class not registered" when calling 'CoGet...
Hi,
Which naming convention is more preferable in C++? The `underscore' method or the camelCase method?
I have coded in Java for a while and I am used to the camelCase naming conventions.
Which one is more prevalent?
Also, while defining a class, is there any preferred ordering of private/public/protected variables/methods?
Are friend...
is there a C++ equivalent for C# null coalescing operator? i am doing too many null checks in my code.. so was looking for a way to reduce the amount of null code
...
This question may seem rather basic, but coming from an engineering (non computer-science) background, I was unsure about what the snippets of '#'s were in some C++ code.
A quick search led me to the concise, well-explained cplusplus tutorial page on preprocessor directives.
But why bother with the concept of preprocessor directives at...
Hello everyone,
I'm trying to learn how create new threads and run them. I need to pass a few variables into the function that is run on the new thread but I can't find out how to actually pass anything to that new function/thread.
I'm following http://www.devarticles.com/c/a/Cplusplus/Multithreading-in-C/1/ but it only goes through h...
Hi,
I have an application that is broken into several libraries for purposes of code reuse. On Windows all I have to do is put the .dll files in the same path as the executable and it automatically finds them. On Linux (since it hardcodes the paths to things) I have to specify the environmental variable LD_LIBRARY_PATH or preload the ...
The question I have are NOT homework questions, but I am considering using these concepts in my assignment. The content,if it helps, is like this: I need to keep track of several union instances and they belong to my own union in one of my own class as class variables. (Note: the number of union instance is unknown, so I cannot just have...
Hello, I'm trying to initialize a private variable of my Class passing a const string &aString to it as parameter.
Here's my method:
void Image::initWithTextureFile(const std::string &inTextureName)
{
Texture2D *imTexture = TEXTURE_MANAGER->createTexture(inTextureName);
if(imTexture)
{
texture = imTexture;
sca...
I have class A, that contains std::vector and I would like to give an access to the vector from outside class A.
The first thing that came to my mind is to make a get function that returns iterator to the vector, but walk through the vector I will need two iterators (begin and end).
I was wondering is there any way (technique or patter...
I have read an entire file into a string from a memory mapped file Win API
CreateFile( "WarandPeace.txt", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 )
etc...
Each line is terminated with a CRLF. I need to find something on a line like "Spam" in the line "I love Spam and Eggs" (and return the entire lin...
Possible Duplicate:
Why must I put a semicolon at the end of class declaration in C++?
Found duplicate, vote to close please.
Why do classes and structs have to be concluded with semicolon in C++?
Like in the following code:
class myClass
{
};
struct muStruct
{
};
This syntax isn't necessary in Java or C#. Why does the...
Hi!
Before I was trying to map my classes and namespaces, by using static calls I succeded and now I need to map the functions of my classes because they will be used dinamically.
Firstly I was thinking to hardcode in the constructor so I can assign a std:map with the string of the name of function pointing to the function itself.
f...
How do I get the window (wxDC or window id) on a certain point (like get window at point(10,20)) using wxWidgets or XCB? ~ Thanks
...
HI All,
How can I calculate direction vector of a line segment, defined by start point (x1, y1) and end point (x2, y2)?
Cheers.
...