c++

Get Keyboard input c++ outside of terminal

I am trying to write a c++ program that responds to keyboard input. I want to run this as a daemon so I can't use cin, I would also like to output each character as it is pressed to a picoLCD screen that I have set up. What is the best way to do this? ...

New alternative to the Gof design pattern book for uml MDD with C++

Hello everybody, I am using lately a tool i.e. Rhapsody for MDD with C++ and I have difficulties on coding the classes by beginning with the uml diagram. Simultaneously I am trying to integrate some of the Gof book examples in the UML diagram and somehow it confuses me.... Is there any book that 1) is quite new (gof is 1994..) 2) ...

Building C++ on both Windows and Linux

Hi, I'm involved in C++ project targeted for Windows and Linux (RHEL) platforms. Till now the development was purely done on Visual Studio 2008. For Linux compilation we used 3rd party Visual Studio plugin, which read VS solution/perojects files and remotely compiled on Linux machine. Recently the decision was to abandon the 3rd party ...

Cygwin GDB gives error 193 when trying to start program.

When I attempt to debug a simple program with gdb on cygwin I get the following: C:\Users\Benoit St-Pierre\workspace_cpp\cs454>gdb a.exe GNU gdb 6.8.0.20080328-cvs (cygwin-special) Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt; This is free software: you...

Is it possible to get the value type from an arbitrary iterator (C++)?

I have a class template <typename Iterator, typename Value> class Foo { public: Foo(const Iterator& it) { ... } ... private: map<Value, int> m_; } }; Is there any way to get rid of Value in the template? The Iterator may or may not be an STL iterator, but it's guaranteed that *it type is Value. I know about iterator_traits...

Trying to return multiple values

I'm having some trouble returning multiple values in this program that calculates min, max, mean, median. The first thing I did was pass reference arguments, and it worked - but I read that creating a struct or class is the preferred method to returning multiple values. So I tried and I haven't been able to get good results. Here is wha...

How to gain Access to member variables of a class using void pointer but Not Object

Hi, I am trying to access member variables of a class without using object. please let me know how to go about. class TestMem { int a; int b; public: TestMem(){} void TestMem1() { a = 10; b = 20; } }; void (TestMem::*pMem)(); int main(int argc, char* argv[]) { TestMem o1; pMem = &(TestMem::T...

System("pause"); - Why is it wrong?

Here's a question that I don't quite understand: The command, System("pause"); is taught to new programmers as a way to pause a program and wait for a keyboard input to continue. However, it seems to be frowned on by many veteran programmers as something that should not be done in varying degrees. Some people say it is fine to use. Som...

Are there any conformant C++ compilers that will leak memory for PODS derived from PODS ?

Given: #include <iostream> using namespace std; struct Concrete { char name[20]; char quest[20]; char favorite_color[13]; }; struct Concrete_with_knobs : public Concrete { int knobs[100000]; }; Concrete * cradle() { return new Concrete_with_knobs; } void grave(Concrete *p) { delete p; } void tomb_of_the_unknown_allo...

creating a DLL in Visual Studio 2005

Hi, I am developing a C++ library that I want to pass on to my team. The library has just one class with a bunch of methods. So, I have developed the class definition file (X.cpp) and a corresponding class declaration file (X.h). Here are my questions -- In Visual Studio 2005, whats is the most straight forward way to build this l...

I'm trying to return a SDL Mix_Music data type, but I'm having problems.

I know I could just make all the Mix_Musics public, and not worry about the problem, but I'd still like to understand how to do it. //header.h class Music { private: Mix_Music * BGMusic, * fall, * reset, * teleport, * win, * singleCubeWin; public: Music(); bool loadMusic(); ...

Display c++ code in php

I am trying to display the contents of a .cpp file in php. I am loading it using fread when I print it out it comes out formatted incorrectly. How can I keep the format without escaping each character? ...

HTTP client example on win32

Dear All, I wanted to develop one HTTP example on win32 platform, which is asynchronous. I am new to win32 programming, can i know what are the api and library win32 platform provides for HTTP send and receive request. I am using windows xp with VS 2005. If any example is available directly on net please provide me link to it, wit...

size_t can not be found by g++-4.1 or others on Ubuntu 8.1

This has happened before to me, but I can't remember how I fixed it. I can't compile some programs here on a new Ubuntu install... Something is awry with my headers. I have tried g++-4.1 and 4.3 to no avail. g++ -g -frepo -DIZ_LINUX -I/usr/include/linux -I/usr/include -I/include -c qlisttest.cpp /usr/include/libio.h:332: error: ‘siz...

Test whether a class is polymorphic

Hello Group, We have a sub-project 'commonUtils' that has many generic code-snippets used across the parent project. One such interesting stuff i saw was :- /********************************************************************* If T is polymorphic, the compiler is required to evaluate the typeid stuff at runtime, and answer will be tr...

Scope, arrays, and the heap

Hello, So, I have this array. It needs to be accessed outside the scope of this function. I have been slapping a pointer to it into a pair which gets put into a deque. But once I'm outside the scope, the local stack is gone, the array is invalid, and I've just got a useless pointer, right? So I've trying to put this array onto the scop...

Any ideas for C++1y ?

I know that C++0x is not out the door yet, but what would you like to see in C++1y? Update: C++0x to be called C++1x :o( ...

How i am able to use string without #include<string> ??

It is given in the STL reference that string class is in string header,then without including the header how the following program is running without an error?? #include<iostream> using namespace std; int main() { string s; cin>>s; cout<<"string entered is : "<<s; } I am using a g++ complier on ubuntu machine. ...

what is the CLSID and PROG ID of Microsoft.sqlserver.Management.Smo

Hi Can any Body tell me wher can i get CLSID and ProgID of Smo library?? As for DMO it is givenn in a Header file by Microsoft.But i am not finding any Header file related to smo. What is the CLSID and ProgID of Smo ?? ANy Hep in this regard greately Appreciated. Thanks in advance. ...

C/C++ Determine Drive a program is running on

I have been having a problem identifying a flash drive in my code. Luckily my code can be run from the flash drive. So is there a way in C (or C++) to tell what drive letter (or drive name) a program is running on? Reason I need to know is when I plug the USB drive in, it is running a program that copies files from the computer to the ...