In most of the example I had seen,
time_zone_ptr zone( new posix_time_zone("MST-07") );
But, I just want to get the current time zone for my running machine. I do not want to hard code the time zone name.
May I know how can I do so in boost?
...
Hello,
I developed a scripting engine that has many builtin functions, so far to call any function code just went into a if .. else if .. else if wall checking the name but I would like to develop a more efficient solution.
Shoul I use a hashmap with strings as keys and pointers as values. How could I do it by using an STL map?
EDIT:
...
Is there a quick way to hook a dll in c++? I know there is Microsoft's Detours thing, but isn't there a quick a simple way just to hook a few dll functions?
For example I want to hook a the function void mytestfunction() in the dll mytestdll.dll to hook_mytestfunction().
thanks in advance!
...
OK, I am trying to get a sub array from an existing array and I'm just not sure how to do it. In my example I have a very large array, but I want to create an array from the last 5 elements of the array.
An example of what I am talking about would be:
int array1 = {1,2,3,...99,100};
int array2[5] = array1+95;
I know this isn't correc...
#include <vector>
struct A {int a;};
struct B : public A {char b;};
int main()
{
B b;
typedef std::pair<A*, A*> MyPair;
std::vector<MyPair> v;
v.push_back(std::make_pair(&b, &b)); //compiler error should be here(pair<B*,B*>)
return 0;
}
I don't understand why this compiles (, maybe somebody may kindly provide detailed expla...
I'm trying to use boost unit testing alongside the Allegro graphics library, but both require main() alterations / overwrites. Has anyone had any experience using both?
Edit 1/29/2010: I've refrained from selecting an answer until I can verify one or another, and due to the... sparse nature of the answers.
...
There is a article in MSDN which provides the procedure:
http://msdn.microsoft.com/en-us/library/aa295838(VS.60).aspx#_core_setting_a_breakpoint_when_a_register_expression_is_true
But it seems that i tis for visual studio 6 ... Actually I can not find the "Breakpoint" entry under "Edit" Menu...
Do you guys know how to do that? I want t...
If a header file contains a function definition it can be inlined by the compiler. If the function is exported, the function's name and implementation must also be made available to clients during linkage. How does a compiler achieve this? Does it both inline the function and provide an implementation for external callers?
Consider Foo....
Sample eg:
messageStruct.hpp
class MessageStructure_t{
public:
struct MsgData_t {
float a;
int i;
}__attribute__((packed))msgdata_m;
};//classs end
I have a file in my project Application.c. I need to access the structure variables here.
Both are different, one .hpp and the other .c
How can I do this ?
Hoping your kind ...
I'm the lead dev for Bitfighter, and am having problems porting the game to 64-bit Linux. This should be a relatively easy and common problem, but it has stumped a number of people and I have been able to find no good information about it.
[[ The code compiles in 32-bit with gcc version 4.1.2, and others, and fails with several variant...
I want to trap WM_SETFOCUS messages on all the current windows.
Whats the best way to do that.
I think SetWidnwosHookEx can be used to for this purpose. Can it be used with WH_CALLWNDPROC or WH_MSGFILTER ?
Also its mentioned that hook procedure must be in separate dll. Is it required.
Can I not have hook procedure in same dll which ins...
Recently I've been writing code similar to this:
messagehandler.h:
#include "message.h"
class MessageHandler {
public:
virtual ~MessageHandler() {}
virtual void HandleMessage(Message *msg) = 0:
};
persistmessagehandler.h:
MessageHandler *CreatePersistMessageHandler();
persistmessagehandler.cpp:
#include "messagehandler.h"
#...
My String class provides an operator char* overload to allow you to pass the string to C functions.
Unfortunately a colleague of mine just inadvertently discovered a bug.
He effectively had the following code.
StringT str;
// Some code.
delete str;
Is there anyway to prevent delete from casting the string object to a char* to prev...
I have to map a set of known integers to another set of known integers, 1-to-1 relationship, all predefined and so on. So, suppose I have something like this (c++, simplified, but you'll get the idea):
struct s { int a; int b; };
s theMap[] = { {2, 5}, {79, 12958 } };
Now given an input integer, say 79, I'd need to find the correspon...
Hi there,
When I include "Python.h" from Python 2.5 in a C++ project, it knows through some magical process that it has to link with "python25.lib" and load "python25.dll" at runtime, though I didn't specified anything neither in "Linker -> Additional Dependencies" nor in "Linker -> Additional Library Directories".
Now I would like to ...
I was looking at some example C++ code for a hardware interface I'm working with and noticed a lot of statements along the following lines:
if ( NULL == pMsg ) return rv;
I'm sure I've heard people say that putting the constant first is a good idea, but why is that? Is it just so that if you have a large statement you can quickly see ...
Is there a waymuch like viewing the result of preprocessing with gcc -Eto see what my objects look like once compiled into object files?
I am talking about GCC, but a solution including MSVC would be fine.
...
I'm trying to draw some bitmap on a CImage object using GDI+ DrawImage. The resulting CImage bitmap seems to be premultiplied by alpha but I can't find any mention of that in the msdn documentation.
What happens when I draw using DrawImage over an CImage HDC ?
...
Hi,
Firstly I'm an engineer, not a computer scientist, so please be gentle.
I currently have a C++ program which uses MySQL++. The program also incorporates the NI Visa runtime. One of the interrupt handlers receives data (1 byte) from a USB device about 200 times a second. I would like to store this data with a time stamp on each sample...
Hi,
I am using two classes in my C++ application. The code is as follows:
class MyMessageBox
{
public:
void sendMessage(Message *msg, User *recvr);
Message receiveMessage();
list<Message> dataMessageList;
};
class User
{
public:
MyMessageBox *dataMsgBox;
};
The msg is a pointer to a derived class object of Message cl...