c++

How does compiler understand the pointer type?

How c++ compiler understands the pointer type? As I know pointer has a size equal to WORD of the OS (32 or 64). So does it store some info in that 32(or 64) bits about type? Just because you can not have a pointer on one type and assign to that pointer another pointer with a different type. ...

Parsing simple MIME files from C/C++?

Hello everyone, I have searched the web for days now but I can't seem to find a good solution to my problem: For one of my projects I'm looking for a good (lightweight) MIME parser. My customer provides MIME formatted files (linear, no hierarchy) which contain 3-4 "parts". The application must be able to split those parts and process t...

Get executing directory in C++

I have a .CAB file that runs as part of an installer process on a Windows CE box. The CAB is written in C++. The CAB file is ran twice as part of an upgrade process but in different locations at different times. How can I find out what directory the .CAB file is being executed from (executing directory) using C++ only? Thanks ...

c# front-end GUI calling linux C++ functions

I am working on a project that the software is written in .NET C# and now new features require that we call third party's APIs that are built in C++ on Linux. We are given the .so files. What is the best way to achieve this? Is developing a JBoss application server and with JNI the best way? Thanks. ...

VSC++, virtual method at bad adress, curious bug

Hello, This guy: virtual phTreeClass* GetTreeClass() const { return (phTreeClass*)m_entity_class; } When called, crashed the program with an access violation, even after a full recompile. All member functions and virtual member functions had correct memory adresses (I hovered mouse over the methods in debug mode), but this function h...

Convert void* representation of a dword to wstring

I am having dumb monday so my apologies for posting such a newbie-like question. I am using CRegKey.QueryValue to return a dword value from the registry. QueryValue writes the value into void* pData and the length into ULONG* pnBytes. Now there is a way of getting it from pData into a wstring probably via stringstream. The closest I ...

Error 404 when trying to fetch the Google Buzz @consumption feed

I'm writing an Qt application and I go through authorization process and everything. I'm even able to fetch the @self feed, but for some reason I get error 404 when trying to do the same thing with @consumption: "Download of https://www.googleapis.com/buzz/v1/activities/v.kiril/@consumption failed: Error downloading https://www.googleap...

Linux / C++: Get Internet IP Address (not local computer's IP)

How can I programmatically get the Internet IP address? 1) If the computer is directly connected to the Internet using a USB modem. 2) If the computer is connected to the internet via another computer or a modem/router. I there a way to do both? P.S. This link gives exactly the Internet IP, but how can I use it in my program? ...

Check whether a string is a valid filename with Qt

Hi, Is there a way with Qt 4.6 to check if a given QString is a valid filename (or directory name) on the current operating system ? I want to check for the name to be valid, not for the file to exist. Examples: // Some valid names test under_score .dotted-name // Some specific names colon:name // valid under UNIX OSes, but not on Wi...

Convert Decimal to ASCII

I'm having difficulty using reinterpret_cast. Lets just say right off the bat that I'm not married ot reinterpret_cast. Feel free to suggest major changes. Before I show you my code I'll let you know what I'm trying to do. I'm trying to get a filename from a vector full of data being used by a MIPS I processor I designed. Basically w...

Function pointers usage

Possible Duplicate: How does dereferencing of a function pointer happen? Hi All, Why these two codes give the same output, Case 1: #include <stdio.h> typedef void (*mycall) (int a ,int b); void addme(int a,int b); void mulme(int a,int b); void subme(int a,int b); main() { mycall x[10]; x[0] = &addme; x[1] = &sub...

How to create a compact Qt4 vBoxLayout

Hello all, I've got a vBoxLayout which contains 3 simple buttons, when I increase the size of the widget containing the layout, the spacing between the buttons increases. I would like to stop this behaviour and keep the buttons in a consistent and compact layout, regardless of the size of the parent widget. This is what I've got so far, ...

Using UIKit from C/C++

The questions might have been already asked, but I want to understand if iPhone's frameworks limited only to Objective-C use or it could also be accessed from C/C++ code? For example, is it possible to use standard iPhone controls from C/C++ code? Are standard classes like NSArray, NSSet accessible from C/C++ code? If they are, could a...

How to check if a .net dll is registered ?

Hi all, I have .net solution (one project written in C++ COM others are written in C#) with its libraries. I would like to make some starttest-tool which would test if all C#, C++ libraries are correctlly registered. How I can do that ? How I can ask .NET if some C# or C++ COM library is regitered ? br, Milan. ...

C++ Virtual Destructors

When creating prototype classes I lay out the destructor as such: virtual ~MyClass(); When finalizing the class in a library I noticed that I cannot add 'virtual'. Is this normal, and is virtual taken into consideration or am I do something wrong? For example; when I try to do this I get a compiler error: virtual MyClass::~MyClass()...

C++ Reference Book

Possible Duplicate: The Definitive C++ Book Guide and List Can someone list a C++ book that is just a reference to the standard library? I don't need a "learning c++" book just one that is a reference. Or at least official documentation or something? Googling only reveals "fan-site" reference. ...

Edges on polygon outlines not always correct

I'm using the algorithm below to generate quads which are then rendered to make an outline like this http://img810.imageshack.us/img810/8530/uhohz.png The problem as seen on the image, is that sometimes the lines are too thin when they should always be the same width. My algorithm finds the 4 verticies for the first one then the t...

Boost::Mutex & Malloc

Hi all, I'm trying to use a faster memory allocator in C++. I can't use Hoard due to licensing / cost. I was using NEDMalloc in a single threaded setting and got excellent performance, but I'm wondering if I should switch to something else -- as I understand things, NEDMalloc is just a replacement for C-based malloc() & free(), not th...

gcc c++ command line error-message parser

Are there any programs for parsing and displaying in a nice format the c++ error messages generated by gcc. I'm really looking for something like less that I can pipe my errors into that will collapse the template parameter lists by default, maybe with some nice highlighting so that my errors are actually readable. (Yes, it's boost's ...

buffer overrun throw return address

Hi, When I throw in a method A, it causes buffer overrun but when I return, it runs fine. I thought throw moves execution to the caller method so the address it goes to should be the same as return address, but i am obviuosly wrong. Is there a way to see what address throw goes to in Visual Studio debugger? Thank you Berkus: does this ...