c++

Linux Write Function

I am writing to a text file using the write function with the file descriptor set a O_NONBLOCK. fd = open(filepath, O_RDWR | O_NONBLOCK , 0777); write(fd, string, size); The questions I have are as following: How large is the file buffer size until it is blocked? If I am using O_NONBLOCK as above, what would happen if the buffer i...

Best way to keep the user-interface up-to-date?

This question is a refinement of my question http://stackoverflow.com/questions/3161392/different-ways-of-observing-data-changes. I still have a lot of classes in my C++ application, which are updated (or could be updated) frequently in complex mathematical routines and in complex pieces of business logic. If I go for the 'observer' ap...

Qt Phonon MediaObject conversion error

Hi, I want to play some WAV files, but I have error C2664 in Visual Studio: error C2664: 'Phonon::MediaObject::setCurrentSource' : conversion error from'const char [24]' to 'const Phonon::MediaSource &' This is the code: Phonon::MediaObject *media_object_; media_object_ = new Phonon::MediaObject(this); media_object_->setCurrentSour...

stl and exceptions

Hi, If I use reserve() to reserve enough elements for a vector, will push_back() (or insert()) throw any exceptions? Is there a reference somewhere that specifies which stl function throw / not throw any exceptions? Thank you. ...

write plug-in system in c++

Good time of day! Prompt please me, where can I find information about creating a system of plug-ins in C + +? linux ...

Can I detach a std::vector<char> from the data it contains?

I'm working with a function which yields some data as a std::vector<char> and another function (think of legacy APIs) which processes data and takes a const char *, size_t len. Is there any way to detach the data from the vector so that the vector can go out of scope before calling the processing function without copying the data contain...

Compilation of large class hierarchy consumes lots of memory after adding boost::serialization

We needed serialization of quite large C++ class hierarchy with lots of inheritance, contraction, shared pointers, etc. I decided to use boost::serialization library. My problem is that while compilation of this library on VS 2008 cl takes over 1 GB of RAM memory. I suppose this is caused by template-based serialization in Boost. This c...

Need to join opensource project for a newbie

Possible Duplicate: C++ OpenSource project for beginner programmer? How to find opensource projects looking for help ? OpenSource Projects - Is there a site which lists projecs that need more developers? hi all, I am a newbie and I need to join a open source project to contribute and enhance my C++ skills. Anyone got a id...

Virtual Qt signal?

Whilst reviewing some Qt C++ code I came across this: class Foo { Q_OBJECT signals: virtual void someSignal(const QString& str, int n) { Q_UNUSED(str); Q_UNUSED(n); } ... }; Now, Qt signals cannot have a body so I'm surprised this even compiles (perhaps because the body is effectively empty). I also don't see the p...

Cost much memory when creating serveral vertex and index buffer

Hi, guys, I met a very weird issue. When I create some very simple VertexBuffer and IndexBuffer in D3D, the memory comsuption reported from TaskManager is huge. I created 60000 index buffer via D3D CreateIndexBuffer method. Each index buffer contains 6 index (int) which represents two triangles. So, one index buffer will occupy 24 bytes...

Imap not downloading emails after certain date

Hi , I am working on Email client application. I have written one sample program for downloading emails from Gmail account using IMAP client library, It downloads emails from AllMail folder. Here I am facing very different problem. my sample application won’t download emails after certain date. Actually I have created my Gmail...

Overloading Delete Operator in c++

In my code, i have overloaded the new and delete operators to get filename and line number. In my code I am using map and stack. When i do erase a particular value from the map it just call my overloaded delete function but I want only explicit delete statements to be able to access my function, not others. How can I do that? ...

Drawing a cube with GlDrawElements()?

Is there a way to draw a cube like this and as a result, only upload 8 verticies and 24 indicies to the graphics card? If so how could this be done? Thanks I currently do it like this: boxdims.x = w; boxdims.y = h; boxdims.z = d; center = c; GLfloat vboverticies[72]; GLfloat vbonormals[18]; Vertex3f verticies[...

How to create a boost ssl iostream?

I'm adding HTTPS support to code that does input and output using boost tcp::iostream (acting as an HTTP server). I've found examples (and have a working toy HTTPS server) that do SSL input/output using boost::asio::read/boost::asio::write, but none that use iostreams and the << >> operators. How do I turn an ssl::stream into an iostre...

Is there a style checker for c++?

I have worked with java for a while now, and I found checkstyle to be very useful. I am starting to work with c++ and I was wondering if there is a style checker with similar functionality. I am mainly looking for the ability to write customized checks. ...

Optimizing C++ code for performance

Can you think of some way to optimize this piece of code? It's meant to execute in an ARMv7 processor (Iphone 3GS): 4.0% inline float BoxIntegral(IplImage *img, int row, int col, int rows, int cols) { 0.7% float *data = (float *) img->imageData; 1.4% int step = img->widthStep/sizeof(float); // The subtraction by o...

How can I find my application's icon?

I am trying to load the icon associated with the application that called my function. The way I am solving the problem for GUI applications is this: AfxGetApp()->LoadIcon(128); // 128 is the IDR_MAINFRAME icon However, the Afx functions, upon looking up the resource, fail for some non-gui applications, since afxCurrentResourceHandl...

Parse this Expression !!

Can anyone parse this following expression for me #define Mask(x) (*((int *)&(x))) I applied the popular right-left rule to solve but cant.. :( Thanks a bunch ahead :) ...

How to distinct read / write operation in boost serialization?

Using the boost serialization library I have a very simple serialize() member function, something like: template <class Archive> void serialize( Archive& ar, unsigned version ) { ar & m_Searcher; } ... and I want to keep it such simple (I don't want to use splitting in particular). But in a case of writing I want to do some...

How to monitor which processes access a particular file in Unix?

I have a file and a lot of process (and process threads) are accessing it. I want to monitor the file to get a listing of what all processes tried to access the file. Being able to record the timestamps also would be excellent for logging purposes, though I can do without it. Is there any Unix utility that does something similar? In c...