c++

Why is the OO concept interface not represented by a keyword in C++?

Languages such as Java explicitly use the interface keyword to denote interfaces. Having used Java, the concept seems useful enough to me to justify a keyword to enforce the concept. Of course one can use a pure virtual class and label it as an interface. However, this keyword seems to be so useful and differentiated from a pure virtu...

StringStream Help Please.

Hi, Im reading a text file with this format: grrr,some text,45.4321,54.22134 Ok so I just have my double valued stored in a string varaible.. Why is it only giving me the first digit of the string? If i start over with just one while loop and a text file of this new format: 21.34564 it works as it should. The thing is, is that my ...

How to change the name of a thread

I have a server application that uses "a lot" of threads. Without wanting to get into an argument about how many threads it really should be using, it would be nice to be able to see some descriptive text in the debugger "threads" window describing what each one is, without having to click through to it and determine from the context wha...

How to execute a command and get output of command within C++?

I am looking for a way to get the output of a command when it is run from within a C++ program. I have looked at using the system() function, but that will just execute a command. Here's an example of what I'm looking for: std::string result = system( "./some_command" ) ; I need to run an arbitrary command and get it's output. I've...

Silverlight and C++ or C++ to C# ongoing code conversion?

I am working on a drawing-based product where I want to produce versions for iPhone, desktop OS/X, Windows Tablets, Silveright-based browser, Windows Mobile, and Windows in that order of priority. For GUI portability, the classic answer is to keep the core in C++ and use Cocoa/Objective-C or WPF/C# thin layers. However, Silverlight com...

C++ Array Member of Constant Length (Initialisation of)

I have a class that contains an array. I want this array to be set at the length of a constant: // Entities.h class Entities { private: const int maxLimit; int objects[maxLimit]; int currentUsage; public: Entities(); bool addObject(int identifier); void show...

trim is not part of the standard c/c++ library ?

Is it me or are there no standard trim functions in the c or c++ library? is there any single function that acts as a trim? If not can anyone tell me Why trim is not part of the standard library? (i know trim is in boost) My trim code is std::string trim(const std::string &str) { size_t s = str.find_first_not_of(" \n\r\t"); siz...

Read Webpage

Hello, I was wondering if anyone knew how to read text from a webpage from within C++. After you first connect to the internet using usual means, you enter the string e.g. "http://www.bbc.co.uk" and the C++ program reads the information: "BBC WebsiteThis is the BBC website...." from the internet. Would I have to write a program that...

product to decrease c++ compile time?

Are there any products that will decrease c++ build times? that can be used with msvc? ...

How to get size and position of window caption buttons (minimise, restore, close)

Is there an API call to determine the size and position of window caption buttons? I'm trying to draw vista-style caption buttons onto an owner drawn window. I'm dealing with c/c++/mfc. Edit: Does anyone have a code example to draw the close button? ...

c++ cout hex values?

I want to do: int a = 255; cout << a; and have it show FF in the output, how would i do this? ...

c++ cout autocase strings?

Is it possible to do something like cout << "my string"; and have my string capitalized? from what i can tell there is no way to do it? i need to wrap it around a function ...

Unit-tests for Boost.Spirit

Hi I'm new to Boost.Spirit and Boost.Test and I would like to know how you verify the correctness of your grammars. Below is a simplified version of how I do it at the moment and I'm pretty sure that there's a better way: Each test case hase a pair of two strings containing the text to parse and the expected result delimited by semicol...

Visual Studio 2005 VB debugging with c++ dll - Mixed Language debugging

I have a vb project which calls functions in a dll. The dll is created in a separate vs project (portaudio), which is written in c. The dll c project compiles clean and builds the required dll, which I am currently dropping in c:\windows\system to vb runtime can see it. VB Project lives in c:\devprojects\vbtest C Project lives in c:\...

Detect executable folder from SDL

I am creating a C++ SDL game engine, and it is relevant to know the executable path since images and other resources are not stored within the executable - they are in a separated folder("res/"). Under Linux, I am using a shell script "rungame.sh" that cd's to the executable path and then runs the executable(using then "./" to reference...

Include indirection on Visual C++

Let's say we have an application that will need Boost to compile. Boost being an external library, updated regularly, and our application having multiple binaries and multiple versions ("multiple" as in "Let them grow and multiply"... don't ask...), we need an easy to update/maintain indirection to have for each app's version link with t...

How to get current CPU and RAM usage in C++?

Hello, is it possible, in C++, to get the current RAM and CPU usage? Is there a platform-indepentent function call? Thank you. ...

Visual C++ 2008 Express Edition error creating a new project.

I have installed Visual C++ 2008 Express Edition on Vista Home Premium and whenever i try to create a new project, no mater which type(CLR, Console, Win32, Empty project) i get "Creating project 'project name' ... project creation failed." However i can open an existing solution. So basically my Visual C++ is useless. Any idea what c...

networking lib + helper (c++)

Are there any c++ networking libs that are very useful and robust? and libs to help them be run better? something like automatically endian conversion when using <<, blocking reads until the struct or w/e your reading completely transfers, something to help debug your protocol, etc ...

Searching fast through a sorted list of strings in C++

I have a list of about a hundreds unique strings in C++, I need to check if a value exists in this list, but preferrably lightning fast. I am currenly using a hash_set with std::strings (since I could not get it to work with const char*) like so: stdext::hash_set<const std::string> _items; _items.insert("LONG_NAME_A_WITH_SOMETHING"); _...