c++

C++ non null terminated char array outputting

Hi I was trying to output a not null terminated char array to a file. Actual thing is, I am receiving packets and then printing their fields. Now as these fields are not null terminated, for example, a data segment which has size of 512 but may or may not be completely occupied. When I write this data to a file I am using simple << ...

Why do we need an inserter function call when doing a set_union for a set?

i need to make the call to the set_union function of STL like this: set<int> a1, a2; set_union(a1.begin(), a1.end(), a2.begin(), a2.end(), inserter(a1, a1.begin()); and not set_union(a1.begin(), a1.end(), a2.begin(), a2.end(), a1.begin()); why is that so? ...

How can I call C++ functions from within ruby

Hi I am an experienced C/C++ developer but I am a novice in Ruby. How can I call a C++ function from with in Ruby? Sorry for the noob question. ...

Syntax error missing ; before *

I have a header file like so: #pragma once #include "gamestate.h" #include "ExitListener.h" class InitialGameState : public GameState { public: InitialGameState(Ogre::Camera *cam, Ogre::SceneManager *sceneMgr, OIS::Keyboard *keyboard, OIS::Mouse *mouse, Ogre::Root *root); ~InitialGameState(void); virtual bool update(Ogre::Re...

what is the best database connectivity support library framework for c c++?

tell me about the best database connectivity support library framework for c c++ ...

Access to external window handles

Hello, I am having a problem with the program I am currently working on. It is caused by the increased security in vista/Windows 7, specifically the UIPI which prevents a window with a lower integrity level 'talking' to a higher one. In my case, i am wanting to tell the window with a high Integrity level to move into our application, It...

how to send return(enter button) character through program

how to send return(enter button) character through program in windows c/c++? I want to send an external program "user name" with enter button through pipe but "\n" and "\r" and EOF are not working.. ...

C++ reference to a shared_ptr vs reference

All, I recently posted this question on DAL design. From that it would seem that passing a reference to an object into a function, with the function then populating that object, would be a good interface for a C++ Data Access Layer, e.g. bool DAL::loadCar(int id, Car& car) {} I'm now wondering if using a reference to a boost::shar...

Logging facilities and Qt

What logging facilities do you use whit Qt ? Do you choose qDebug(), qWarning(), qCritical(), qFatal() methods, or maybe something like Log4cpp (Log4cplus etc.), or maybe some custom-maked code ? ...

Wrapping cf.net application to C++ project

Hi, I would like to wrap cf.net project (exe) to c++ project(exe) and communicate via internal calls (main exe to cf.net exe, communication to protection methods, written in c++). Idea is to make better protection against decompiling(+ protection). Any idea how to do that? any sample code of wrapping executable? ...

Two ways of calling default constructor

I have the following code: struct B { //B() {} int x; int y; }; void print(const B &b) { std::cout<<"x:"<<b.x<<std::endl; std::cout<<"y:"<<b.y<<std::endl; std::cout<<"--------"<<std::endl; } int main() { B b1 = B(); //init1 B b2; //init2 print(b1); print(b2); return 0; } When I start program (vs2008, debug) I have the...

A Better Boost reference?

The thing that really turns me off about Boost is their documentation. What I need is a good reference, and instead of explaining what a good reference is to me I would give example: java.sun.com/javase/6/docs/api/ Yes I love it. It is also this: cppreference.com/wiki/stl/vector/start On the other hand what I find about boost is some...

I need a C++ Compiler

If possible I want one that's free, popular (so support on forums will be faster) and.... just good. I don't really know much about compilers so I don't know what exactly is good. ...

time table / datebook as in Sunbird for Qt?

I would like to implement a calendar in my Qt-based program as it is already implement in Mozilla Sunbird (different colors and categories are important). Is there any "simple" possibility to realize that or do I have to create it all by myself, beginning at zero? Is there a good tutorial to create such a calendar with standards, so tha...

How can I find out how much memory my c++ app is using on the Mac

Certain operations in my app are using more memory than I think they should, and I would like to log the current memory usage to help identify which they are. Is there a system call that will return the amount of memory currently in use? ...

Why Can't I store references in an STL map in C++?

Hi I undersatnd that references are not pointers, but an alias to an object. However, I still don't understand what exactly this means to me as a programmer, i.e. what are references under the hood? I think the best way to understand this would be to understand why it is I can't store a reference in a map. I know I need to stop think...

Swap 2D Double Arrays in c++

I have the following method to swap two double arrays (double**) in c++. Profiling the code, the method is accounting for 7% of the runtime... I was thinking that this should be a low cost operation, any suggestions? I am new with c++, but i was hoping to just swap the references to the arrays. 62 void Solver::Swap(double** &v1, dou...

Exception Handling in Qt Script with C++ ?

I have the following action which is executed when a certain button is pressed in a Qt application: #include <shape.h> void computeOperations() { polynomial_t p1("x^2-x*y+1"),p2("x^2+2*y-1"); BoundingBox bx(-4.01, 4.01,-6.01,6.01,-6.01,6.01); Topology3d g(bx); AlgebraicCurve* cv= new AlgebraicCurve(p1,p2); g.push_ba...

Class to class access, from ref class to gui class

Hi, how I can access controls of Form class from another simple class Lets say I have create new clr (c++ .net 2008) windows application, & add a lable1 on it, (Form1.cpp & Form1.h created by default having namaspace tmp_beginInvoke_c) then I create a new b.h file & add a simple reference class b. like code below, #include "Form...

Extracting basic info from animation file

I'm writing an application that handles metadata for images and all kinds of animations, so I'm looking for a way to find basic info about an animation file, e.g: length (in minutes/seconds/frames) aspect ratio of pixels resolution of individual frames framerate Right now, I let my program execute mplayer -identify animfile.avi an...