I'm trying to make a recursive tree printer for a template class tree so that it can print the tree without knowing what kind of data is there beforehand. But I can't figure the syntax out that I need.
Right now I know that the code would only print the root of the tree, but I can't even get it to do that.
Ideas?
edit:
Here's the co...
We are looking at using Google's Protocol Buffers to handle serialization between a c++ application and a c# application via networking.
My question is, I've found a couple of different verisions for c#. Both look pretty good, however, does anyone know what is different (if anything) between the two
protobuf-net
jskeet / dotnet-proto...
How can I specify the Unicode character INFINITY (U+221E) in C++ without directly pasting the symbol (∞) into my code file? I've tried \x221e but that results in a warning, and \u221e gives me a LATIN SMALL LETTER A WITH CIRCUMFLEX (U+00E2).
QString label;
label.append(tr("HP: \u221e\n\n"));
...
I've wrote a small piece of code that reads the current battery charge/discharge on my laptop.
I followed the example code on this MSDN page.
My program updates the information every 100ms (by calling the DeviceIoControl function with IOCTL_BATTERY_QUERY_STATUS as control code) but the read value changes only after 5-10 seconds.
For exa...
Hi. I have a class like this:
class Foo
{
long long Id;
string x;
string y;
// other member variables and functions
};
I would like to store this in a hash_set (or hash_map), but use the Id member variable as the key for inserting and searching. I'm not sure how I can do this. I thought of the following ways, but none of t...
My main frame has a CMFCMenuBar member, which contains the menu of the current document type.
I would like to add/remove a sub-menu dynamically.
For example, if the user chooses to display a map pane, I want to add a map submenu next to the "File" menu.
Vice versa, if the map pane gets closed, I also want to remove the map menu items.
...
This is almost the same as http://stackoverflow.com/questions/101647/how-to-schedule-a-task-to-run-when-shutting-down-windows, except I need to do it programmatically. Also, I need the guarantee that when the script is run, no application can cancel the shutdown anymore.
Is this possible?
Thanks.
Update, with a little context: My comp...
I have an array containing multiple integers, is there a common way for sorting it from high to low?
...
I'm looking for a winapi function that will allow me to change current logged in user's password. In my case, I know current password of logged in user. I use Windows 7 Ultimate.
Thanks.
Background
The background will look weird, but I'm going to describe it for clarification. My personal home PC is used by several users (dad, sister,...
Ok, it sounds strange, but I need a sample code, that throws EXCEPTION_FLT_UNDERFLOW. I already have code to handle that exception. Now I need sample, that throws this damn EXCEPTION_FLT_UNDERFLOW. Any advises?
...
In my application we will present the video stream from a traffic camera to a client viewer. (And eventually several client viewers.) The client should have the ability to watch the live video or rewind the video and watch earlier footage including video that occurred prior to connecting with the video stream. We intend to use wxWidge...
Hello all,
I have a producer/consumer concurrency problem that I'm working on. The problem is that I'm getting a segfault thrown immediately after trying to create my first thread.
Relevant code:
customer is a struct declared as:
struct pr2_customer
{
pthread_t customer_id;
};
typedef struct pr2_customer customer;
customers i...
I have this code here that has two arrays. It sorts arr[], so that the highest value will be in index 0. Now the second array arr1[] contains strings, I'd like the code to apply whatever changes where made to arr[] to arr1[]. So that arr[0] would return 6, while arr1[0] would return the string "d1". Notice how "d1" was at the same index...
Examine the following code:
This works:
T *p = (std::find( this->first(), this->last(), *pPos ));
if( p != last() )
{
this->push_back(data);
T *right = (this->last() - 1);
T *left = (this->last() - 2);
while( *pPos != data )
std::iter_swap( left--, right-- );
return const_cast<T*>(pPos);
}
This does n...
So in visual studio i have my solution with two projects, first one is managed c++ code and second one is unmanaged c++ library (waffles). I want to use classes from library in my managed code.
If i simply add 'include "GMacros.h"', then i get 'cannot compile with /clr' error. Tried to wrap include in #pragma unmanaged/managed, but it d...
How can I resolve the ambiguous call between these two in C++?
Color(int, int, int)
Color(float, float, float)
It is both ambiguous when the values are hardcoded i.e. Color(1, 2, 3) and when they are variables Color(r, g, b). Why wouldn't the compiler resolve according to data type? In variable form?
EDIT:
Sorry, too much C++ makes me...
I'm having a problem linking a C++ project in VS2008 when using the /clr compile option. I am getting the following build errors:
Class1.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEA): (0x0200046f).
Class1.obj : error LNK2022: metadata operation failed (...
I'm currently trying to implement the A* pathfinding algorithm using C++.
I'm having some problems with pointers... I usually find a way to avoid using them but now I guess I have to use them.
So let's say I have a "node" class(not related to A*) implemented like this:
class Node
{
public:
int x;
Node *parent;
Node(int _x...
I'd like to have width and height of the currently focussed window. The selection of the window works like a charm whereas the height and width are always returning 1.
#include <X11/Xlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
Display *display;
Window focus;
XWindowAttributes attr;
int revert;
disp...
I am reposting a comp.std.c++ Usenet discussion here because that group has become very unreliable. The last few posts I've submitted there have gone into the void, and activity has all but ceased. I doubt I've been banned and/or everyone else just lost interest. Hopefully all interested people will find this discussion, and there will b...