c++

An overloaded operator takes function pointer as parameter, how do i retrieve arguments of function pointer

i have an overloaded operator << trying to make it work like this mystream<<hex<<10; i have overloaded method mytream& operator<<(ios_base& (*m) ios_base&) This gets called whenever hex is encountered cause the parameter passed in the method is a function pointer of type same as hex or like some other output manipulators like de...

Writing file to remote PC

Hi I am running some experiments on an embedded platform. The problem is, that the memory ressources are limited; hence, I am thinking of writing the output into a file on a remote machine. I am wondering what is the best way to realise that? I am using C++ on the embedded platform. I was thinking of communicating over a TCP/IP socket w...

How can I run my application in place of the default Windows XP shell?

I was having a discussion with a colleague about whether or not the following is possible: Install an MFC application from a USB drive in Windows XP (this installation would be initiated manually by a user with sufficient privileges to install software). After rebooting, this application should start instead of the default Windows XP s...

Enumerating digits

For my book class I'm storing an ISBN number and I need to validate the data entered so I decided to use enumeration. (First three inputs must be single digits, last one must be a letter or digit.) However, I'm wondering if it is even possible to enumerate numbers. Ive tried putting them in as regular integers, string style with double q...

C++ Template preprocessor tool

Is there a compiler or standalone preprocessor which takes C++ files and runs a template expansion pass, generating new C++ code with expanded template instantiations? I remember such a tool in the mid-90s when templates were still new and experimental, and the preprocessor was a way to do template programming with compilers without nat...

How to detect #includes of nonexistant files in gcc

I am using Xcode's modified gcc, and I notice that sometimes when I include a file that doesn't exist, it just silently skips it. How can I get it to give me a warning? ...

Overloading << to define manipulators

I found this question on archived file at joelonsoftware.com http://discuss.joelonsoftware.com/default.asp?joel.3.594503.11 "Hi, I'm having a particularly slow day and can't get my head round an operator overloading problem. I would like a class to be able to accept data via an insertation operator, i.e: myClassInst...

How to Find All Callers of a Function in C++?

I'm refactoring some code in C++, and I want to deprecate some old methods. My current method for finding all of the methods looks like this: Comment out the original method in the source file in which I'm working. Try to compile the code. If a compiler error is found, then make a note comment out the call and try to recompile. Once th...

Is there any way to pass an anonymous array as an argument in C++?

Hi all, I'd like to be able to declare an array as a function argument in C++, as shown in the example code below (which doesn't compile). Is there any way to do this (other than declaring the array separately beforehand)? #include <stdio.h> static void PrintArray(int arrayLen, const int * array) { for (int i=0; i<arrayLen; i++) p...

Setup Gedit For C++ Development

Hello, I'm starting in C++ development, but i like to use Gedit for writing the files, but like for Ruby on Rails and many other languages, are some tools and configurations for Gedit that makes develop more easy and comfortable, and another question, what is the best for C++, SVN, CVS, Git and others...? Thanks, and sorry about my engl...

Is there a way to get non-locking stream insertion/extraction on basic_iostream in Windows?

I'm a C++ developer who has primarily programmed on Solaris and Linux until recently, when I was forced to create an application targeted to Windows. I've been using a communication design based on C++ I/O stream backed by TCP socket. The design is based on a single thread reading continuously from the stream (most of the time blocked i...

Error When Compiling C++ File In GCC

Hello, I'm using Linux Ubuntu Intrepid Ibex and using as compiler the gcc, but when i try to compile me C++ project file the compiler give me this error: ubuntu@ubuntu-laptop:~/C++$ gcc ClientFile.cpp gcc: error trying to exec 'cc1plus': execvp: No such file or directory What is wrong? Please Help Me!! ...

std::auto_ptr Compile Issue in Visual Studio 6.0

Update: Edited code example to use AutoA for the workaround (which was the original intention). Realized this after seeing rlbond's answer. I am trying to incorporate the usage of auto_ptr in my code based on recommendations from this thread: http://stackoverflow.com/questions/478482/express-the-usage-of-c-arguments-through-method-int...

Build An Linux Executable Using GCC

Hello, I'm using Linux Ubuntu Intrepid Ibex and compiling C++ files with GCC, but when i compile, gcc makes a *.out file, that is the executable, but how i can make Linux executables? Thanks! ...

OpenGL V DirectX (the endless war)

Hi there, I'm trying to work out whether to learn DirectX or to continue on with OpenGL... I dev mainly games, and I know enough of OGL to get by, nothing more. I know that DirectX and D3D are popular amongst professional games developers, is there any reason behind this? Which API is easier to learn and use? Is there any difference i...

Javadocs documentation for C++

Is it possible to use the javadocs documentation system for other languages. Since javadocs produces such a nice output it would be great if you could use it in other languages. If this isn't possible, what other documentation generators are used for the C++ language, preferably opensource. ...

Using Mono for developing in C++

Hi, I am starting to use Mono to develop applications in C# and C++. I wanted to ask you, how is Mono compiling the C++ code? is it using GCC? It is amazing to see that it has the STL containers... Also, can I use the Boost libraries and GSL libraries with Mono? Thanks in advance!!! ...

Runtime error, possible input problem?

I have a book class that takes title, author, copyright, ISBN number, and checkout for a book object. However, I'm getting a runtime error when the program runs. After the user inputs the title and presses enter, the program skips down, showing the rest of the outputs, and then terminates the program giving a runtime error. I tried to ...

use operators in templates in c++

I am trying to implement a List class using pointers and am trying to implement a function LOCATE(T x) where T is for the template and returns the first position of the element x if found, else returns last position + 1. My functions code is template<class T> int List<T>::locate(T n) const { int size = end(); Node<T> * p = head_...

Is comeau compiler worth it compared to gcc?

Hi all, I have been using gcc,g++ for my C,C++ application development till now and have found it to be amazing. But browsing through stackoverflow I found many members stating that error reporting in Comeau compiler is much more than any other compiler. Is this true? I haven't invested in any commercial release of a compiler. Is it rea...