In most versions of windows, you can get to the menu by pressing the F10 key, thus avoiding having to use the mouse. This behaviour does not appear to be present in Windows Mobile 5.0, but is desirable as the device I am using will be more keyboard than touch screen driven.
Is there a way of programmatically activating and using the ...
In C++, is it safe to extend scope via a reference?
In code, what I mean is:
MyCLass& function badIdea()
{
MyClass obj1;
...
return obj1;
}
...
Hey!
Is there any way to check if a given index of an array exists?
I am trying to set numerical index but something like 1, 5, 6,10. And so I want to see if these indexes already exist and if they do just increase another counter.
I normally work with php but I am trying to do this in c++, so basically I am trying to ask if there is a...
Writing something like this using the loki library,
typedef Functor<void> BitButtonPushHandler;
throws a compiler error, but this works
typedef Functor<void,TYPELIST_1(Matrix3D*)> Perspective;
Functor.h:530: error: '((Loki::FunctorHandler, int>)this)->Loki::FunctorHandler, int>::f' cannot be used as a function
Functor.h:530: e...
How do I clear the cin buffer in C++?
...
Hi,
When I write to the beginning of the file,it always leaves the first line empty,and start writing from the second one.
How can I make it write from the first line,including the first one and on?
Thanks.
...
When trying to compile a file that include winnt.h via windows.h, I get the following error:
MyGl.cpp
..\microsoft sdks\windows\v6.0a\include\winnt.h(964) : error C2988: unrecognizable template declaration/definition
..\microsoft sdks\windows\v6.0a\include\winnt.h(964) : error C2059: syntax error : 'typename T, size_t N>
char (*RtlpNumb...
If I have two things which are hex, can I someone how append their binary together to get a value?
In C++,
say I have
unsigned char t = 0xc2; // 11000010
unsigned char q = 0xa3; // 10100011
What I want is somehow,
1100001010100011, is this possible using bit-wise operators?
I want to extract the binary form of t and q and append t...
void addNewNode (struct node *head, int n)
{
struct node* temp = (struct node*) malloc(sizeof(struct node));
temp -> data = n;
temp -> link = head;
head = temp;
}
The code give above is the popularly wrong version of a function for adding a new node at the head of a linked list.
Generally the correct versions are like,
...
I am completely stumped as to why this code does not get any SDL keypress events. The other SDL events (removed for clarity) work fine. It does not work on my XP or Vista machines. No compile/link errors, just never recieve a keydown event.
#include "SDL/SDL.h"
// Yes SDL.lib and SDLmain.lib are linked
Uint32 TimeLeft(void)
{
stati...
Hi, in C++ I have two chars holding hex values e.g.:
char t = 0x4;
char q = 0x4;
How would i compare if the two values held in the char are the same?? I tried
if (t == q) // should give me true
but no, any help, thanks!
...
Is it possible to write a C++ template that changes behavior depending on if a certain member function is defined on a class?
Here's a simple example of what I would want to write:
template<class T>
std::string optionalToString(T* obj)
{
if (FUNCTION_EXISTS(T->toString))
return obj->toString();
else
return "toSt...
Hi, if I have a range of say 000080-0007FF
and I want to see if a char containing hex is within that range, how can I do this? Thanks a lot.
Example
char t = 0xd790;
if (t is within range of 000080-0007FF) // true
Thanks
...
Is there a native c++ variable type that's "bigger" than a double?
float is 7
double is 15 (of course depending on the compiler)
Is there anything bigger that's native, or even non-native?
...
Does anyone know of a simple way for a C++ program to communicate directly with a MySQL database? I have looked at MySQL++ and found it to be very confusing. If anyone knows of a very simple way of doing this, please let me know.
Thanks
P.S. I am developing on a Windows machine. PHP and MySQL web web application setup. C++ setup to...
I wrote a C++ project in VS2005, and used lots of STL container with its plus-in STL. However, I found STL in VS2005 does not have a hash_map in it, I want to use SGI hash_map. How can I change my project to use SGI STL?
Thanks for Brian's method, it works! And it's simple.
...
I've read the description of "functionoids" here. They look like a poor-man's version of Boost::function and Boost::bind. Am I missing something? Is there a good reason to use them if you're already using Boost?
...
CString is quit handy, while std::string is more compatible with stl container.
I am using hash_map, however, hash_map does not support CString as key, so I wish I could convert CString into std::string, is it possible?
Write a CString hash function seems take lots of time.
CString ------> std::string ? how can I do?
std::string -----...
Hello,
Using qsort in C we pass in a comparison function e.g.
int cmp(const void*, const void*);
the protoype of qsort expects a int (* )(const void* , const void*) so we call:
qsort(..., cmp);
but it is equally valid to call:
qsort(..., &cmp);
and this is what we would have to do if we passed in a static member-function in C++...
I have a large project for which I am attempting to use TDD.
I am using Tut as my test framework, which has its flaws but is sufficient for what I need.
I need to exploit link time test seams, each test must be in its own executable. The project for this executable then launches itself as a post build step.
Unfortunately, this means t...