c++

Interprocess Communication between C++ app and Java App in Windows OS environment

We have a C++ application on Windows that starts a java process. These two apps need to communicate with each other (via snippets of xml). What interprocess communication method would you choose, and why? Methods on the table for us are: a shared file(s), pipes and sockets (although I think this has some security concerns). I'm open to...

How to configure Visual Studio for native C++ (unmanaged) development?

I am completely new to C++ development and am trying to learn it in Visual Studio. How can I be sure that I am learning only C++ and not the managed extensions? What configuration settings do I need to change? What project types should I stick to? Any other advice? Side issue: I have tried turning off Language Extensions under Proj...

Converting simple C++ code to C# automatically

I have a file in C++ containing constant definitions, I want to use the same definitions in a C# project. Since both projects are part of a bigger project, I want if there is a change (addition/deletion) in the C++ file it should get reflected in corresponding C# file too. I want to keep the 2 files in sync. I was wondering if there is a...

optimized memcpy

Are there faster alternatives to memcpy() in C++? ...

How do I call C++ functions from a Lua script?

I'm using Visual Studio 2005. ------------------------[ luapassing.cpp ]-------------------- #include "lua.h" static int myCfunc (Lua_State *L){ double trouble = lua_tonumber(L,1); lua_pushnumber(L,16.0 -trouble); return 1; } int luaopen_luapassing (Lua_State *L){ static const lua_reg Map [] = {{"dothis",myCfunc},{NULL,NULL...

What Visual Studio add-ins do you use for C++ refactoring?

I have just started using Visual Assist X for C++ refactoring in Visual Studio 2008. It is quite good, but IMO, not to the same level as what ReSharper has for C#. I am wondering what people are using for C++ refactoring, especially for larger code base. Here are the add-ins that I have tried so far: * Visual Assist X * Refactor! Pro M...

Visual Studio: How to Build a Static Library for use in Another Project (Avoiding STL Linking Errors)

I'm new to Visual Studio and Windows as a development platform, and I'm having troubles linking a static library from one 'Project' into an executable in another. The library builds without error, but linking bails after finding several STL template instantiations defined in the library. For the purpose of this question, Project A build...

CStatic Custom Control

I am trying to create a custom CStatic control in vc++ and have a few problems. I originally was just using a CStatic control with the SS_BLACKRECT style. This was good for the situation until I needed to display an image over the control on demand. I figured out all the logistics behind actually drawing the image onto the control but I ...

Why isn't stl compare function a member?

Just idly curious why the compare function for stl::sort can't be a static member? I have a small little helper class foo that is declared and defined in a header, but now I have to create a foo.cpp file for the implementation of cmp() so it isn't multiply defined. I also have to think of a suitably decorated name so fooCmp() doesn...

How to select an unlike number in an array in C++?

I'm using C++ to write a ROOT script for some task. At some point I have an array of doubles in which many are quite similar and one or two are different. I want to average all the number except those sore thumbs. How should I approach it? For an example, lets consider: x = [2.3, 2.4, 2.11, 10.5, 1.9, 2.2, 11.2, 2.1] I want to somehow...

How to call c++ functionality from java

I have a Java program that is mostly GUI and it shows data that is written to an xml file from a c++ command line tool. Now I want to add a button to the java program to refresh the data. This means that my program has to call the c++ functionality. Is the best way to just call the program from java through a system call? The c++ progr...

serving up a png file via ifstream

This seems like a really simple task, so bear with me. I'm trying to extend a server which serves up files and webpages. Currently the server gets an HTTP request, parses it, and calls a function called sendFile: void sendFile(ostream& ostr, std::string filename) { std::ifstream ifs(filename.c_str(), std::ios_base::binary); os...

C++ linker problems with static method

I'm writing a Vector3D class that calls a static method on a VectorMath class to perform a calculation. When I compile, I get this: bash-3.1$ g++ VectorMath.cpp Vector3D.cpp /tmp/cc5cAPia.o: In function `main': Vector3D.cpp:(.text+0x4f7): undefined reference to 'VectorMath::norm(Vector3D*)' collect2: ld returned 1 exit status The cod...

Format of parameter to display call graph for templated method with gprof?

What is the command line format to display function call graph for a method in templated class with gprof? For simple C method you would specify it like: gprof -f foo myprogram > gprof.output How do you specify method parse from the following: template <typename T> class A { public: template <typename X> bool parse(X& x,...

which C++ material should i work on next?

I've been doing C++ for 3-4 months in a local college and I'm doing extra reading / learning using Accelerated C++ and so far, I've "finished" it. Now, I'm wondering which book to get next that'll help me code better in C++. I've looked around and found this: http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-lis...

which is the fasted method to draw a large DIB onto Screen in windows

I am programming in windows c++. I want to know which is the fasted method to draw a DIB onto Screen. The image maybe stretched. Faster than StretchDIBits, Faster than SetDIBitsToDevice. Faster than StretchBits. and with high stretch quality. Many thanks! ...

interposers on Windows

Is it possible to substitute system functions, as is possible on Linux and Solaris using the LD_PRELOAD For example by setting the environment variable: LD_PRELOAD=/path/to/mymalloc.so I would have my replacement malloc functions instead of in the C runtime already installed in the system libraries. All other functions in the system d...

best way to write a linux daemon

For work i need to write a tcp daemon to respond to our client software and was wondering if any one had any tips on the best way to go about this. Should i fork for every new connection as normally i would use threads? ...

C++ API for multiplatform development

I want to learn C++ to work on various platform (primarily, Linux and Windows). I have come across few solutions like the Boost C++ library, Qt toolkit, etc that can be used to write programs which will compile on both the platforms. I want to know from the community, what type of library would you refer to use and if any of you had exp...

Can a C++ programmer take Andrè LaMothe's book seriously?

I put his name in the title, but his book is Tricks of the Windows Game Programming Gurus. I got the first chapter online, and in his very first code example, he uses void main() and several define macros, and his game loop consists of a long switch statement (not even pseudo use of objects). Can I take this book seriously as a C++ prog...