c++

What is the smallest embedded browser I can use in C++ ?

I need to build my application GUI using HTML/CSS/JavaScript with a C++ backend all cross platform. I made simple tests with QtWebKit, XULRunner and Mozilla. Well from the simple testes I notice something that is very batters me and it is the deployment size of the browsers libs/framework. It's big: 8 MB and above. Is there some kind o...

Non-destructive parsing and modifying of HTML elements in C++

I have a need to do some simple modifications to HTML in C++, preferably without completely rewriting the HTML, such as what happens when I use libxml2 or MSHTML. In particular I need to be able to read, and then (potentially) modify, the "src" attribute of all "img" elements. I need it to be robust enough to be able to do this with any...

When to use C#/C++

Which areas of programming are each language best suited for? I like both C++ and C# but i prefer to use C# because of .NET. My question is when will you use C++ and when do you use C#? So if you make a financial application for a company you will use C#? ( It's easy to design a form and connect to a database without downloading 3rd p...

Is there a generic way to iterate over a specific variable in a group of objects?

Lets say I have a linked list with a bunch of different data in it. class Node { public: Node* next; AAA dataA; BBB dataB; CCC dataC; }; Is there a way I make one iterator that would iterate over whatever variable I specify (rather than making three separate ones for each variable). I understand that the iterator coul...

C++ LNK2019 and LNK1120 errors

I'm trying to do another exercise from Deitel's book. The program calculates the monthly interest and prints the new balances for each of the savers. As the exercise is part of the chapter related to dynamic memory, I'm using "new" and "delete" operators. For some reason, I get these two errors: LNK2019: unresolved external symbol W...

How to avoid infinite recursion in C++ class templates

I have a matrix class with the size determined by template parameters. template <unsigned cRows, unsigned cCols> class Matrix { ... }; My program uses matrices of a few sizes, typically 2x2, 3x3, and 4x4. By setting the matrix size with template parameters rather than run-time parameters allows the compiler to do a lot of inlinin...

Strange C++ boolean casting behaviour (true!=true)

Just read on an internal university thread: #include <iostream> using namespace std; union zt { bool b; int i; }; int main() { zt w; bool a,b; a=1; b=2; cerr<<(bool)2<<static_cast<bool>(2)<<endl; //11 cerr<<a<<b<<(a==b)<<endl; //111 w.i=2; int q=w.b; cerr<<(bool)q<<...

Any good C/C++ web toolkit ?

I've been looking around and came across the WT toolkit, Is it stable? Any good? I was stumped on how to go about this in C++, given the lack of libraries and resources concerning web developement. (CGI/Apache) The purpose of my application is to populate some data from a Sybase ASE15 database running GNU/Linux & Apache Hence allow some...

Using boost::tokenizer with string delimiters

I've been looking boost::tokenizer, and I've found that the documentation is very thin. Is it possible to make it tokenize a string such as "dolphin--monkey--baboon" and make every word a token, as well as every double dash a token? From the examples I've only seen single character delimiters being allowed. Is the library not advanced en...

Constructor with references not properly assigning??

I'm trying to write a simple color class that's supposed to be as versatile as possible. Here's what it looks like: class MyColor { private: uint8 v[4]; public: uint8 &r, &g, &b, &a; MyColor() : r(v[0]), g(v[1]), b(v[2]), a(v[3]) {} MyColor(uint8 red, uint8 green, uint8 blue, uint8 alpha = 255) : r(v[0]), g(v[1]), b(v[2]), a(v[3]) { ...

Is it safe to read past the end of an array?

Let's say I have a constructor like this: MyColor(uint8 vec[]) { r = vec[0]; g = vec[1]; b = vec[2]; a = vec[3]; } But I call it like this (3 elements instead of 4): uint8 tmp[] = {1,2,3}; MyColor c(tmp); But now vec[3] is undefined... is it safe to assign this value to a? If not, there's no nice workaround to check if vec[3] is se...

OpenGL Windowing Library for 2009

Trying to decide on a library for creating a window and capturing user input for my OpenGL app, but there are just way too many choices: GLUT (win32) FreeGLUT OpenGLUT SFML GLFW SDL FLTK OGLWFW Clutter Qt Others? GLUT is simply outdated. I liked GLFW but it seems you can't set the window position before displaying it (I wanted it cen...

About fork system call and global variables

I have this program in C++ that forks two new processes: #include <pthread.h> #include <iostream> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <cstdlib> using namespace std; int shared; void func(){ extern int shared; for (int i=0; i<10;i++) shared++; cout<<"Process "<<getpid()<<", shared " ...

C++ Class forward declaration drawbacks?

Hi! I want to use forward declaration of a class in my software, so I can have typedefs and use them inside the class full declaration. Smth like this: class myclass; typedef boost::shared_ptr<myclass> pmyclass; typedef std::list<pmyclass > myclasslist; class myclass : public baseclass { private: // private member declaration...

How to know a certain disk's format(is FAT32 or NTFS)

I am programing under windows, c++, mfc How can I know disk's format by path such as "c:\". Does windows provide such APIs? ...

What are concepts?

I've heard all this new (on /.) about C++0x not having concepts anymore, but I have no idea what they are? Can someone explain to me? ...

Big O Notation for an Algorithm

I can't solve a problem; can someone help me? What is the Big O notation for the below statement:- for (int i=2;i<=n;i=i*4) sum++; ...

How to handle multiple keypresses at once with SDL?

Hi, been getting myself familiar with OpenGL programming using SDL on Ubuntu using c++. After some looking around and experimenting I am starting to understand. I need advice on keyboard event handling with SDL. I have a 1st person camera, and can walk fwd, back, strafe left and right and use the mouse to look around which is great. Her...

How to escape a string for use in Boost Regex

I'm just getting my head around regular expressions, and I'm using the Boost Regex library. I have a need to use a regex that includes a specific URL, and it chokes because obviously there are characters in the URL that are reserved for regex and need to be escaped. Is there any function or method in the Boost library to escape a strin...

Programming Project Books?

Possible Duplicates: Suggested C++ books? Language Books/Tutorials for popular languages Project-based books / websites Hello everyone! I am trying to learn C++ better. I know the basics of it, but I want to deepen my knowledge. What are some good books that not only teach you concepts of the language, but give projects for ...