c++

C++ :: Boost :: posix_time (elapsed seconds. elapsed fractional seconds)

I'm trying to come up with an answer to two questions that didn't seem hard at first. Q1 : How do I obtain the number of elapsed seconds between UTC.Now() and a given date? A1 : Just like in the code below! Q2 : How do I determine how many fractional seconds have elapsed since the last "full" second ? I'd like to print the "total_elapsed...

Guides to help learn C++ specifically from a C# background

Is there a guide/reference anyone would recommend to pick up C++ specifically if you have strong experience of C#? There are C++ guides, but a lot start with the absolute basics and I feel I've covered a lot with my C# learnings. But the absolute basics may be a good thing and I may be barking up the wrong tree - I imagine some people ...

Running a separate process or thread in Qt

I'm writing my first proper useful piece of software. Part of it will involve the user viewing an image, and choosing to accept or reject it. Doing this will cause the image to be saved to an accepted or rejected folder, and possibly rotated and/or resized. At the moment, my rotate/resize/save operation is pausing execution of my progra...

Lightweight and portable regex library for C/C++?

Hello, What is a good and portable regex library for C/C++? (C++ preferably) ...

Win32: Modal dialog not returning focus

Hi, I'm writing a win32 wrapper classes, mainly to learn more about win32 programming. To get around the problem of c-style callbacks, the following method stores/retrieves the pointer using SetWindowLong/GetWindowLong and passes it to the actual winproc. LRESULT CALLBACK WinClass::WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l...

Copying an integer to a Buffer memcpy C++

Basically I would like to store the address of a pointer in a buffer. Don't ask me why char * buff = "myBuff"; char * myData = (char*)malloc(sizeof(char*)); int addressOfArgTwo = (unsigned int)buff; memcpy(myData, &addressOfArgTwo, sizeof(char*)); cout << "Int Val: " << addressOfArgTwo << endl; cout << "Address in buffer:" << (unsigned...

Some questions about special operators i've never seen in C++ code.

I have downloaded the Phoenix SDK June 2008 (Tools for compilers) and when I'm reading the code of the Hello sample, I really feel lost. public ref class Hello { //-------------------------------------------------------------------------- // // Description: // // Class Variables. // // Remarks: // // A normal compiler would have m...

How to make a file name and a set extension

#include <iostream> #include <fstream> using namespace std; int main() { string name; cout<<"What would you like new html file to be named?"<<endl; getline(cin,name); cout<<"Creating New Html File...Moment."<<endl; ofstream myfile (name); if(myfile.is_open()) { } } I need to make myfile with a .html ext...

Is there a translator tool for translating EBNF to boost::spirit?

The translator could be in boost::spirit too. I couldn't find any in the Internet. Maybe I should make one? ...

Event / Task Queue Multithreading C++

I would like to create a class whose methods can be called from multiple threads. but instead of executing the method in the thread from which it was called, it should perform them all in it's own thread. No result needs to be returned and It shouldn't block the calling thread. A first attempt Implementation I have included below. The ...

Hooking within my application

What should I do to implement a hook-like system? This is my setup: I have these static libraries: A.lib B.lib A and B are like modules that can be included together within a same application. The thing is I have a function in A that I want to expose to B. I was doing this with a callback list... but I'm not comfortable with this id...

SendMessage from DLL to a window in another process in Vista

I am pulling my hair out on this one. I am trying to send a message to a window in another process. I keep getting Access Denied (0x5) from GetLastError() after calling SendMessage or PostMessage or PostThreadMessage. I have tried turning off UAC. I have also accounted for UIPI by ensuring that the Integrity Levels match accross proc...

C++ Programming Book Example on Stack

In this book, I am learning how the book writes a stack, but when I compile it, it reaches a compile error: #define DEFAULT_SIZE = 10 class Stack { private: int size; int top; int *value; public: Stack( int size = DEFAULT_SIZE ); virtual ~Stack(); bool isFull(); bool isEm...

URL escaping MFC strings

How do you URL escape an MFC CString? ...

Difference between C++ reference type argument passing and C#'s ref?

I always thought they were about the same thing but someone pointed me out in one of my answers that such ain't quite true. Edit: Here is what I said and the comment I got. Edit2: What's the difference between C++'s: public: void foo(int& bar); and C#'s public void foo(ref int bar){ } ...

What's the difference between a header file and a library?

One of the things I'm having a hard time understanding is how the compiler works. I'm having a lot of difficulties with it, but in particular I keep getting headers and libraries mixed up. If somebody could clear things up a bit, that'd be great. ...

boost spirit headers deprecated

I am following the quickstart guide for boost::spirit, and I get this compiler warning when I include : "This header is deprecated. Please use: boost/spirit/include/classic_core.hpp" Should I be worried about this? (quick start guide: http://spirit.sourceforge.net/distrib/spirit_1_8_5/libs/spirit/doc/quick_start.html , with full source...

Why is NULL undeclared?

I have a problem with this struct contructor when I try to compile this code: typedef struct Node { Node( int data ) // { this->data = data; previous = NULL; // Compiler indicates here next = NULL; } int data; Node* previous; Node* next; } NODE; when I come this error occurs: \linkedli...

what is difference btw /MD and /MDD in VisualStudio C++?

Hi What is difference betwwen /MD and /MDD( multi threaded debug dll ) in c/c++->code generation propertis of visual studio .... ...

POD low dimensional vector in boost

I'm looking for POD low dimension vectors (2,3 and 4D let say) with all the necessary arithmetic niceties (operator +, - and so on). POD low dimension matrices would be great as well. boost::ublas vectors are not POD, there's a pointer indirection somewhere (vector are resizeable). Can I find that anywhere in boost? Using boost::array ...