c++

What is the current best practice for distributing a database with an app?

Platform: Windows / Database: Access / Language: C++ Several years ago I had a Windows app that uses a database and I just installed an empty database as part of the install process. The database had all of the queries and macros I needed. I am wondering what the current best practice for this sort of thing is: Do you build the databas...

C++: pass-by-reference and the const keyword

Hi guys, I have a question regarding the passing of a map by reference. Let's consider the following piece of codes: void doNotChangeParams(const map<int, int>& aMap){ if (aMap.find(0) != aMap.end()){ cout << "map[0] = " << aMap[0] << endl; } } and I'm having a map myMap and make a call like this: doNotChangeParams...

What is the purpose of this code?

I am struggling to understand why the initialization of pprocessor, below, is written like this: class X { ... private: boost::scoped_ptr<f_process> pprocessor_; }; X:X() : pprocessor_( f_process_factory<t_process>().make() ) //why the factory with template {...} instead of just writing X:X() : pprocessor_( new t_process() ) {...

C/C++ need a clever way to track function calls

I am looking for a clever way to track function calls and returns. I know I can use the debugger, but I would like a way to just have it print something out to the terminal when calling a function vs having to step through code. I am thinking that I might be able to use the preprocessor, but I am not sure what would be the best way to go...

What is the C version of RMI

I have a set of functions in C/C++ that I need to be available to accept calls and return values to C/C++ code in a remote location, similar to RMI on the java platform. With RMI the Java methods are set up through the rmiregistry and remain available in memory to accept requests. I'm looking for similar functionality in C/C++, but i'm a...

Compound argument declaration

To make my code more concise, can I do something like int f(int const x, y, z), g(int const x, y, z); to declare functions f and g which each take three int const arguments? Edit: Perhaps here is a better example: int f(int const a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z); How would that not be m...

Evenly distributed dashed lines with OpenGL?

I notice that drawing dashed lines with GL will not make them even apart unless each vertex is equidistant from the last. Is there a way to simply make the whole path dashed evenly regardless of the distance between each point? Thanks ...

module machine type 'THUMB' conflicts with target machine type 'ARM'

Hi, I had a windows mobile application running for ARMV4 (Pocket PC 2003) We got a new device XXXCE6 (ARMV4I), we need to compile the application for it, we followed these steps: install the Device SDK Build-> configurartion manager choose NEW from active solution platform for New Solutin platform we have chosen XXXCE6 (ARMV4I) , an...

Overload operator == for STL container

I'm trying to remove a class object from list<boost::any> l l.remove(class_type); I tried writing something like this as a member function bool operator == (const class_type &a) const //not sure about the arguments { //return bool value } How would you write an overload function to remove an object of class from a std::list of b...

Error when exiting cobol runtime. what can i do to fix it

*** glibc detected *** /acu/722/bin/runcblrpc: free(): invalid next size (fast): 0x082d8368 *** ======= Backtrace: ========= /lib/libc.so.6[0xb7e38fc4] /lib/libc.so.6(cfree+0x9c)0xb7e3a95c] /acu/722/bin/runcblrpc[0x8241053] ======= M...

Question about how to general a bezier curve by inputing several points.

Hi, i want to generate a bezier curve pass through several points i input by mouse.These points are more than four,can anyone help me and give me some suggestions about how to implent it? More thanks. Good luck! ...

Windows 7 : Subauthentication Package

Hi all, I have this problem, I was trying to create a subauthentication package for windows 7. But no samples are available. Can someone please help. Sid ...

Serialization tree structure using boost::serialization

I have to serialize libkdtree++ in my program, the tree structures are briefly described as following: struct _Node_base { _Node_base * _M_parent, *_M_left, * _M_right; template<Archive> serialize(Archive &ar, const unsigned int version) { ar & _M_left & _M_right; } } template<typename V> struct _Node : public _Node_base {...

When a window closes, do my destructors get called?

If a window is closed (like with sending WM_CLOSE), are the destructors of objects called? I followed my source code with a break point in that situation, but the compiler doesn't seem to pass through my destructor. Is the program closed without calling any destructors? ...

Who knows how to use the mc.exe (Message Compiler) ?

I am trying to use the mc.exe to make message files for my event log writing program. But even the sample message file provided by the Microsoft won't compile. Who knows how to write a message file that could be compiled by mc.exe? EDIT: The error message I got is : msgs.mc(1) : error : expected keyword - ?? Edit 2: Problem sol...

changing float type to short but with same behaviour as float type variable

Is it possible to change the float *pointer type that is used in the VS c++ project to some other type, so that it will still behave as a floating type but with less range? I know that the floating point values never exceed some fixed value in that project, so I want to optimize the program by memory it uses. It doesn't need 4 byte...

Xcode not showing console output; How do you flush the console?

I have a simple C++ program that uses cout and printf to log stuff and it is only showing at the end when the program is closed but if I'm stepping through the program using debug nothing is shown. Did anybody have this problem? This is probably a punishment for doing homework for someone else. :|. ...

Print longest string duplicated M times

here is code which prints longest string duplicated M times #include <iostream> #include <stdlib.h> #include <string.h> #include <stdio.h> using namespace std; #define M 1 #define MAXN 5000000 char c[MAXN],*a[MAXN]; int pstrcmp( char **p,char **q){ return strcmp(*p,*q) ;} int comlen(char *p,char *q){ int i=0; while (*p &...

prevent long running averaging from overflow?

suppose I want to calculate average value of a data-set such as class Averager { float total; size_t count; float addData (float value) { this->total += value; return this->total / ++this->count; } } sooner or later the total or count value will overflow, so I make it doesn't remember the total value by : cl...

error C2664 - code compiles fine in VC6; not in VS 2010

I have a typedef, a class with a member vector using that type and then a method using std::<vector>::erase(). #typedef DWORD WordNo_t; class CWordList : public CObject { public: WordNo_t* begin() { return m_Words.begin(); } WordNo_t* end() { return m_Words.end(); } void truncate (WordNo_t *Ptr) { if (Ptr == end()) return; AS...