c++

Setting existing cookies to use with libcurl

does current version of libcurl support firefox 3.0 and above cookies file (cookies.sqlite) ? I'm trying to set the file to allow cookies to be used when retrieving the data from web address. int return_val = curl_easy_setopt(hCurl, CURLOPT_COOKIEFILE, \..\cookies.sqlite); return_val is zero but i don't get to see the expected data. ...

what is return type of new in c++?

Hi All, in C, malloc() returns void*. But in C++, what does new return? double d = new int; Thanks, Arul ...

Hiding Mouse Pointer on window Screen using GDI in c++

How to hide the mouse pointer on the window screen of GDI, kindly give me some hints. ...

How do I go about overloading C++ operators to allow for chaining?

I, like so many programmers before me, am tearing my hair out writing the right-of-passage-matrix-class-in-C++. I have never done very serious operator overloading and this is causing issues. Essentially, by stepping through This is what I call to cause the problems. cMatrix Kev = CT::cMatrix::GetUnitMatrix(4, true); Kev *= 4.0...

Get time of execution piece of code

How do I get milliseconds time of execution of a piece of code in Qt/C++? ...

How do I execute QTcpSocket in a different thread?

How do I execute QTcpSocket functions in a different thread? ...

Windows 7 UAC elevation

I have a single thread that I'd like to run as an administrator in my application. The rest of the application I can happily run as the default user level (asInvoker). Is this possible? I notice there is an "ImpersonateLoggedOnUser" function. Can I somehow use this to log the administrator on and then get the thread to impersonate th...

per process configurable core dump directory

Is there a way to configure the directory where core dump files are placed for a specific process? I have a daemon process written in C++ for which I would like to configure the core dump directory. Optionally the filename pattern should be configurable, too. I know about /proc/sys/kernel/core_pattern, however this would change the pat...

How to use QSerialDevice in Qt?

Hello, I am trying to use QSerialDevice in Qt to get a connection to my serial port. I also tried QextSerialPort before (which works on Windows Vista but unfortunately not on Windows XP ..) but I need an API which supports XP, Vista and Win7... I build the library and configured it this way: CONFIG += dll CONFIG += debug ...

win7 + vc7.1 + mfc = stackoverflow

Hello! I've moved my vc7.1 project from WInXP to Win7. After rebuilding i got stackoverflow error in function _malloc_dbg when i start the program. "Unhandled exception at 0x0051bf0f in XXX.exe: 0xC00000FD: Stack overflow." ---------------------- Call stack: > msvcr71d.dll!_malloc_dbg(unsigned int nSize=140, int nBlockUse=2, const cha...

design patterns used in STL(standard template library)

I am learning STL and design patterns . i wanted to know is there any document or link that explains how design patterns are implemented in STL i did the google but not able to get much data ...

C++ Windows IOCP - HTTP POST data missing

I have written a very simple IOCP HTTP server that works for the GET verb, but not POST. I create a socket and a listen thread in which accept() is waiting for a connection. When a client connects I call ioctlsocket() to unblock the socket then I associate the socket with IOCP and finally call WSARecv() to read the data. Some data is i...

C++ struct sorting

I have a vector of custom Struct that needs to be sorted on different criteria each time Implementing operator < will allow only one criteria But I want to be able to specify sorting criteria each time I call C++ standard sort. How to do that? Please note it is better to be efficient in running time.. Thanks ...

STL map--> sort by value?

Hi I wonder how can I implement the STL map sorting by value. For example, I have a map m map<int, int>; m[1] = 10; m[2] = 5; m[4] = 6; m[6] = 1; and then.. I'd like to sort that with the m's value. So, if I print the map, I'd like to get the result like m[6] = 1 m[2] = 5 m[4] = 6 m[1] = 10 this. How can I sort like this way? Is...

CDateTimeCtrl - preventing 'focus' change when setting date

I'd like to use a CDateTimeCtrl to allow the user to select a non-weekend date. So, if the user increments the day (via a keypress) - and the resulting day is found to fall on a weekend - then the control should skip forward to the following Monday (don't let issues about month changes distract you, it's not relevant). Usually it's not ...

is it possible to control the windows of an external app

I want to take the control of the window for exmple i want to force to external app to start minimized I mean when i enter this command myapp Firefox Firefox starts but minimized firefox is not important I mean i want to do it with any gui application If yes can any body show me the way? ...

Binder and variadic template ends up in a segmentation fault

I wrote the following program #include <iostream> template<typename C, typename Res, typename... Args> class bind_class_t { private: Res (C::*f)(Args...); C *c; public: bind_class_t(Res (C::*f)(Args...), C* c) : f(f), c(c) { } Res operator() (Args... args) { return (c->*f)(args...); } }; template<typename C, typename Res,...

Function template overloading: link error

I'm trying to overload a "display" method as follows: template <typename T> void imShow(T* img, int ImgW, int ImgH); template <typename T1, typename T2> void imShow(T1* img1, T2* img2, int ImgW, int ImgH); I am then calling the template with unsigned char* im1 and char* im2: imShow(im1, im2, ImgW, ImgH); This compiles fine, but i g...

How is application virtualization implemented?

I am trying to understand how software like App-V and sandboxie (http://www.sandboxie.com/) work. But for the life of me, I can't think of anything that could make this possible. How do they intercept API calls and trick the target software? If someone would say that it's just magic and pixie dust, I would believe them. Seriously though,...

C++ change sort method

Possible Duplicate: C++ struct sorting Is it possible to sort a vector in C++ according to a specified sorting method, like used in Java's Collections.sort that takes a Comparator? ...