c++

boost::spirit 2.0 incomplete docs?

I've just completed the boost spirit 2.0 tutorial: http://www.boost.org/doc/libs/1_39_0/libs/spirit/doc/html/index.html Only to find out that the rest of the promised documentation is completely missing. Specifically, I was really hoping for a page that contains all the available parsers and their attributes. Does anybody know where I c...

WaitForSingleObject( )

I have got myself stuck into a really amazing issue here.The code is like as below. class A { public: A(){ m_event = CreateEvent(NULL, false, false, NULL); // create an event with initial value as non-signalled m_thread = _beginthread(StaticThreadEntry, 0, this); // create a thread } stat...

How can Unix pipes be used between main process and thread?

I am trying to channel data via pipes whenever a signal arrives from a thread to the main process. Is this possible? How can this be done? The problem: A child thread reads data and puts it into a queue. Main application does its own stuff, however, when data is available on the queue, it should be notified by the thread, and st...

C++ memory management and vectors

Hi All, I'm getting very confused with memory management in relation to vectors and could do with some basic concepts explaining. I have a program that uses big vectors. I created the vectors with the new operator and release them at the end of the program with delete to get the memory back. My question is, if the program crashes or ge...

Large file support in C++

64bit file API is different on each platform. in windows: _fseeki64 in linux: fseeko in freebsd: some another sh.t How to make it convinient and portable? Any examples? ...

How to inject non-ASCII characters into a string literal in C/C++

I have a program that reads in a character array. I need the value of the string in memory to be equal to hex 0x01020304 which are all non-ASCII characters. So the question is, how do I pass non-ASCII characters into a string literal variable at runtime? ...

Blt() to create a layer effect. Not working. Am I using the wrong logical function or something?

I have one window that is drawn to by various objects to create a layered effect (think of a heads up display where one object draws a compass, the other draws the grid lines, another the altimeter reading etc). So, each object has a black memory bitmap that it draws to. When I call that objects Draw function, the memory bitmap is blitte...

inet_addr function and leading zeros

Hi, I'm trying to use the 'inet_addr' function to convert a char IP address, but I think since the IP Address i'm passing in to the 'inet_addr' function has leading zero's (192.169.055.075), the 'inet_addr' function is interpreting this differently. Any suggestion on how to remove the leading zeros? Thanks char IPAddr[20]; //192.169.05...

How do you use gdb?

I decided to find out how our C/C+ *nix practitioners use the gdb debugger. Here is what I typically use: b - break filename.c:line #, function, filename.cpp:function, className::Member n, c, s -- next continue step gdb program name => set breakpoints ==> run [parameter list] (I do this to set break points before the program starts)...

Read/Write Locks

As part of a project at work, I implemented a Read/Write lock class in C++. Before pushing my code to production, what sort of tests should I run on my class to be sure it will function correctly. I've obviously performed some sanity tests on my class (making sure only one writer can access at a time, making sure releases and claims ...

Is there a way to extract a custom request header with cgicc

I am using Cgicc , which has some methods to extract specific request headers, e.g. getUserAgent would return "User-Agent" header. Is there a generic method that can return an arbitrary header value, e.g. something like getHeaderValue("x-my-header"); Is there a way to do this using cgicc? and if cannot be done with cgicc, how else c...

C++ template with map allocator problem

I define a template function which loads a map from a CSV file: template <class T> bool loadCSV (QString filename, map<T,int> &mapping){ // function here } I then try to use it: map<int, int> bw; loadCSV<int>((const QString)"mycsv.csv",&bw); But get htis compile time error: error: no matching function for call to ‘loadCSV(con...

I get "no member function declared in class" error on my copy constructor when I compile a templated class

Hi, I am using C++ and I am trying to create a templated class (a Stack). I would like to define the copy constructor and the assignment operator. There are defined in the header and then I implement them in the cpp file. Here are the problems I get: - For the copy constructor: prototype for ‘Stack::Stack(const Stack&)’ does not m...

Program Deployment Failing

The project my team has been working on has reached a point where we need to deploy it to computers without the development environment (Visual Studio 2005) installed on them. We fixed the dependency issues we had at first, but we're still having issues. Now, once the installer is finished, our project gets stuck somewhere before enteri...

Show window in Qt without stealing focus

I'm using the Qt library to show a slideshow on the second monitor when the user isn't using the second monitor. An example is the user playing a game in the first monitor and showing the slideshow in the second monitor. The problem is that when I open a new window in Qt, it automatically steals the focus from the previous application. ...

Is there a way to "delete" a pure virtual function?

I have an abstract class with a couple pure virtual functions, and one of the classes I derive from it does not use one of the pure virtual functions: class derivative: public base { public: int somevariable; void somefunction(); }; anyways, when I try to compile it, I get an error (apparently a class is still considered abstr...

Passing Classic ASP VBScript Parameters ByRef to COM c++

It's pretty simple. There's a c++ function that uses ByRef parameters to return three variables at the same time. STDMETHODIMP CReportManager::GetReportAccessRights(long lReportCode, VARIANT_BOOL *bShared, VARIANT_BOOL *bRunOnly, VARIANT_BOOL *bCopy) However, the VBScript ASP code doesn't seem to pick up the new values for bShares, b...

Stuck on C++ template - deriving from std::map

I'm going to extend the existing std::map class and add a new function to it: template<typename key_type, typename value_type> class CleanableMap : public Cleanable, public std::map<key_type, value_type> { CleanableMap(const CleanableMap& in); //not implemented CleanableMap& operator=(const CleanableMap& in); //not implemented ...

What does -fPIC mean when building a shared library?

I know the '-fPIC' option has something to do with resolving addresses and independence between individual modules, but I'm not sure what it really means. Can you explain? ...

Uploading files through a HTTP POST in C++

I'm trying to send a file and other POST variables to a PHP script on my server. There are no good resources on Google and the code samples I've found don't work. Preferably without using cURL. ...