c++

DM_simtoolTest.h:39: error: conversion from `int (*)(int)' to non-scalar type `std::string' requested

My code: Functionality: It is a function expects a three arguments and create a file. void performLog(string strStoredProcName, int nCount, double time) { int tme=(int) time; int hour=tme/3600; tme=tme%3600; int min=tme/60; tme=tme%60; int sec=tme; char *StrLen; int len = 0; int lenpass = 0; ...

Using an abstract class in C++

I'm trying to use an abstract class when passing an extended object as an parameter to a function, but my attempts so far have led to some compiler errors. I have a few clues as to what the problem is, I'm obviously not allowed to instantiate an abstract class, and I believe some of the code in MyClass is trying to do this, even though ...

Why switch statement cannot be applied on strings?

int main() { switch(std::string("raj")) //Compilation error - switch expression of type illegal { case"sda": } } ...

Using a pointer to an object stored in a vector... c++

I have a vector of myObjects in global scope. std::vector<myObject> A method is passed a pointer to one of the elements in the vector. Can this method increment the pointer, to get to the next element, myObject* pmObj; ++pmObj; // the next element ?? or should it be passed an std::Vector<myObject>::iterator and increment that ins...

C++ ULONG definitions to vb.net or c# equivalent?

Trying to use a call recording API using sockets. We have the API documentation but the samples are all in C++. How would I declare the following in vb.net or c#??? #define SIF_GENERAL 0x08000000 #define SIF_CONFIGURATION 0x08010000 #define SIF_ARCHIVE 0x08020000 #define SIF_SEARCH 0x08030000 #define SIF_REPLAY 0x08040000 #define SIF_S...

Duplicating arrays when equalizing Objects.

Greetings everyone. I'm in need of some experiance here as how to deal with dynamic arrays with Objects. I've a class 'SA', consisting of several objects 'Obj1', 'Obj2' etc... Within the class I have a dynamic array 'SA_Array' which I initialize in the following manner where size sets its length: double * SA_Array; SA_Array = new doub...

How to inhib "Delayed Write Failed" message?

Hi, I have a Windows service running in a specified user account with write permission on a shared drive on another computer. The service is logging on that shared drive. I allow the user to enter mapped path or network path (e.g. z:\MyRemoteFolder or \RemoteComputer\MyRemoteFolder) as the log destination. As I am in an unstable netw...

What are some tricks I can use with macros?

In our legacy code, as well as our modern code, we use macros to perform nifty solutions like code generations, etc. And we make use of both the # and ## operators. I am curious how other developers use macros to do cool things, if they use them at all. ...

stack & realloc question C++

int main() { char myString = NULL; realloc(&myString, 5); strncpy((char *)&myString, "test", 5); } Seems to work Fine but, i'm still slightly confused about stack vs heap, is this allowed? Does myString need to be freed manually or will it be released when it goes out of scope? Edit: Thanks for the responses, so i presume t...

C++: Is it possible to share a pointer through forked processes?

I have a count variable that should get counted up by a few processes I forked and used/read by the mother process. I tried to create a pointer in my main() function of the mother process and count that pointer up in the forked children. That does not work! Every child seems to have it's own copy even though the address is the same in ...

Implementing Table-Lookup-Based Trig Functions

For a videogame I'm implementing in my spare time, I've tried implementing my own versions of sinf(), cosf(), and atan2f(), using lookup tables. The intent is to have implementations that are faster, although with less accuracy. My initial implementation is below. The functions work, and return good approximate values. The only probl...

QToolBar: is there a way to make toolbar unhidable?

In Qt, if I right-click on a toolbar the menu will be shown that allows me to hide the toolbar. I need to disable this functionality because I want the toolbar to be unhidable. Is there a way to do this? ...

C++ MI static template - static method disapears at join

#include <iostream> using namespace std; /* TA <-- defines static function / \ | B <-- subclass TA, inherits it so B::StaticFunc can be used. \ / C <-- want to inherit static func from A, subclass B privately */ template <class T> class TA { public: // return ptr to new insta...

returning a set of keys in the map matching the criteria

First I will give a specific case, and the I would like to see if it can be applied to a general problem. Say I have map. And I want to get all the keys meeting a certain criteria. For example all keys that contain "COL". My naive implementation will be template<typename T> void Filter (map<string, T> & m, std:set<string> & result, ...

Concurrency: Are Python extensions written in C/C++ affected by the Global Interpreter Lock?

One of Python's strongest points is the ease of writing C and C++ extensions to speed up processor intensive parts of the code. Can these extensions avoid the Global Interpreter Lock or are they also restricted by the GIL? If not, then this "ease of extension" is even more of a killer feature than I previously realized. I suspect the ans...

Returning an object as a property in ATL

I am creating a COM object using Visual Studio 2008 and ATL. Adding simple properties and methods is easy enough but now I want to do something more complicated. I want to give access to a C++ object via a property of my COM object, so I can do something like: // Pseudo-code var obj = CreateObject("progid"); obj.aProperty.anotherPrope...

why does throw "nothing" causes program termination?

const int MIN_NUMBER = 4; class Temp { public: Temp(int x) : X(x) { } bool getX() const { try { if( X < MIN_NUMBER) { //By mistake throwing any specific exception was missed out //Program terminated here throw ; } } catch (bool bTemp) { cout<<"cat...

CBlobCache usage - ATL Server Library

Someone may have an example of use for CBlobCache? ...

can you create a lib or dll in VS 2005 and link with VS 2008

Hello, I am using visual studio 2008 SP1. And I am creating a desktop application using MFC. I have a library I want to link with my application. However, the library was written in WIN32 visual studio 2005. I am been having a trouble linking: fatal error LNK1104: cannot open file 'AgentLib.lib' I am wondering if it is because I ...

boolean datatype question

Is it acceptable to assign 'NULL' to a boolean datatype? ...