I am a latecomer to XML - have to parse an XML file. Our company is using xerces already so I managed to cobble together a sample app (SAX) that displays all the data in a file. However, after parsing is complete I was expecting to be able to call the parser or some other entity that had an internal representation of the file and itera...
The problem is pretty basic.
(I am puzzled why the search didn't find anything)
I have a rectangular "picture" that stores it's pixel color line
after line in a std::vector
I want to copy a rectangular region out of that picture.
How would I elegantly code this in c++?
My first try:
template <class T> std::vector<T> copyRectFr...
I'm having trouble keeping my app responsive to user actions. Therefore, I'd like to split message processing between multiple threads.
Can I simply create several threads, reading from the same message queue in all of them, and letting which ever one is able process each message?
If so, how can this be accomplished?
If not, can you...
I'm trying to create a single instance Qt application and I'm at the point this works, but now I want to focus the already started instance when a second is started.
QWidget::find(g_hWnd) should return the widget but it fails and crashes on w->show();
Any thoughts?
#pragma data_seg("Shared")
HWND g_hWnd = NULL;
#pragma data_seg()
#prag...
I have a COM server with a method currently returning an integer:
[
object,
uuid("..."),
dual,
helpstring("IMyCOMServer Interface"),
pointer_default(unique)
]
__interface IMyCOMServer : IDispatch
{
[id(1), helpstring("method MyQuery")]
HRESULT MyQuery([in] BSTR instr, [out,retval] int* outint);
};
This comp...
I've been having crash problems due to heap problems, so I guess a buffer overflow is happening somewhere. How do I detect it?
...
The windows forms control library project (C++) I writes uses an unmanaged dll. The unmanaged dll has a header file (a Cheshire cat). And I just include it in the control library project. And calls functions in the unmanaged dll (of course with proper marshaling). This compiles and builds. The problem is when I go ahead to add the contro...
Now I'm geting an error:
1>c:\development\document_manager\document_manager\storage_manager.h(7) : error C2079: 'storage_manager::db' uses undefined struct 'sqlite3'
with
#pragma once
#include "sqlite3.h"
class storage_manager
{
sqlite3 db;
sqlite3** db_pp;
public:
void open()
{
sqlite3_open("data.db", db_pp);
...
Hi,
I need to share a stack of strings between processes (possibly more complex objects in the future). I've decided to use boost::interprocess but I can't get it to work. I'm sure it's because I'm not understanding something. I followed their example, but I would really appreciate it if someone with experience with using that library...
basically i have (state, state code) pairs, that are subsets of country
[USA] -> [VT] -> 32
so i'm using std::map<tstring<std::map<tstring, unsigned int>> but i'm having trouble with assignment of the state code
for(std::map<tstring, std::map<tstring, unsigned int>>::const_iterator it = countrylist.begin(); it != countrylist.end(); ++i...
int main(void)
{
std::string foo("foo");
}
My understanding is that the above code uses the default allocator to call new. So even though the std::string foo is allocated on the stack the internal buffer inside of foo is allocated on the heap.
How can I create a string that is allocated entirely on the stack?
...
I'm being offered a C++ job and need a quick brush-up project so I can become fluent in the language again. Currently I develop iPhone applications and became fluent in C/Obj-C from a background of Python, Java and C# in a matter of days. I'm looking for an idea for a small project, or a brush-up sort of course online that I can complete...
I know that sqlite doesn't perform well with extremely large database files even when they are supported (there used to be a comment on the sqlite website stating that if you need file sizes above 1GB you may want to consider using an enterprise rdbms. Can't find it anymore, might be related to an older version of sqlite).
However, for ...
I've created this basic 3D Demo using OpenGL/SDL. I handled the keyboard callback so I can "strafe" left and right using 'a' and 's' and move forward and backward using 's' and 'w'.
However, I would like to now make it so I can control the direction my camera is "looking" based off my mouse movements. Just like in a FPS shooter when...
Just a simple question:
if I had a simple vector class:
class Vector
{
public:
float x;
float y;
float z;
};
Doesnt the RAII concept apply here as well? i.e. to provide a constructor to initialize all values to some values (to prevent uninitialized value being used).
EDIT or to provide a constructor that explicitly asks the u...
Like when you drag a file on top of another one and change the order, like that.
...
I'm attempting to measure test coverage for the first time using gcov. Now that I'm past the initial learning curve, things seem to be going well, except for one little snag. I expect that it boils down to a lack of understanding on my part, so I'm hoping someone familiar with gcov can explain what's going on.
The issue is that I hav...
I'm coding a basic OpenGL game and I've got some code that handles the mouse in terms of moving the camera.
I'm using the following method:
int windowWidth = 640;
int windowHeight = 480;
int oldMouseX = -1;
int oldMouseY = -1;
void mousePassiveHandler(int x, int y)
{
int snapThreshold = 50;
if (oldMouseX != -1 && oldMouseY !...
I am new to makefiles and facing some issue with it. I have created the following makefile. It works correctly. But when I modify the main.cpp and run make, it says "everything is up to date". I need to do a make clean and run make again, everything will work.
Looks like there is some issue with this makefile and I can't figure it out ...
Hello,
I need to reverse a function with hard Math operations, I'm asking here to check if it's even possible, eventually for help.
public static UInt32 Func_4(UInt32 P, UInt32 X, UInt32 G)
{
UInt64 result = 1;
UInt64 mult = G;
if (X == 0)
return 1;
while (X != 0)
{
...