c++

Howcome some C++ functions with unspecified linkage build with C linkage?

This is something that makes me fairly perplexed. I have a C++ file that implements a set of functions, and a header file that defines prototypes for them. When building with Visual Studio or MingW-gcc, I get linking errors on two of the functions, and adding an 'extern "C"' qualifier resolved the error. How is this possible? Header f...

printf vs cout in C++

What is the difference between printf and cout in C++? ...

c++ scrollbar to window

hey, here im creating a window: _hWnd = CreateWindowEx( WS_EX_CLIENTEDGE, //dwExStyle (LPCWSTR) _wndClass, //lpClassName L"", //lpWindowName WS_CHILD | WS_HSCROLL | WS_VSCROLL , //dwStyle CW_USEDEFAULT, //X CW_USEDEFAULT, //Y 200, //nWidth 150, //nHeight hWndParent, //hWndParent NULL, //hMenu hInstance, //hInstance...

Is valgrind crazy or is this is a genuine std map iterator memory leak?

Well, I'm very new to Valgrind and memory leak profilers in general. And I must say it is a bit scary when you start using them cause you can't stop wondering how many leaks you might have left unsolved before! To the point, as I'm not an experienced in c++ programmer, I would like to check if this is certainly a memory leak or is it th...

Do I have to start from beginning?

If I have: std::size_t bagCapacity_ = 10; std::size_t bagSize = 0; A** bag = new A*[bagCapacity_]; while (capacity--) { bag[capacity] = new A(bagSize++); //**here I'm loading this array from the end is it ok?** } And also can I delete those object from starting at the end of the array? while (capacity--) { delete bag[capacity]; ...

RegQueryValueEx not working with a Release version but working fine with Debug

Hi. I'm trying to read some ODBC details from a registry and for that I use RegQueryValueEx. The problem is when I compile the release version it simply cannot read any registry values. The code is: CString odbcFuns::getOpenedKeyRegValue(HKEY hKey, CString valName) { CString retStr; char *strTmp = (char*)malloc(MAX_DSN_STR_LEN...

QWidgetAction stays visible after trigger()

I have a a QWidgetAction which holds a QWidget composed of a QLineEdit and a QPushButton. Once the user press the button the QWidgetAction call the trigger slot. Now I have a QMenu which I activate with exec. The problem is that even though trigger is called (I've connected it to a print function as well to check) the menu won't close. ...

C++/Qt Apps on Ovi Store?

Can one develop C++/Qt based application for Symbian and N series phone and upload the same to Ovi store ?. I hear conflicting stories. I understand the existence of Smart Installer etc. But my question is as of today can I code and ship apps to Ovi store ?. If not any clue how long before it becomes a reality ?. Ankur Update: htt...

TCP Message Structure with XML

Hello Everybody, I'm sending messages over TCP/IP and on the other side I parse TCP message.For example this is one of the sent messages. $DKMSG(requestType=REQUEST_LOGIN&requestId=123&username=metdos&password=123)$EDKMSG Clarification: $DKMSG( //Start )$EDKMSG //End requestType //Parameter REQUEST_LOGIN //Parameter Val...

How to call a C++ function that takes a reference from C# code

HI, I have a C++ function like the following: int ShowJob(const JobData& data); How does this translate to a DLLImport statement which I can use to call the function from C#? ...

c++ generic pointer to (member?) function

I can't seem to declare a generic pointer to function. Having these 2 functions to be called: void myfunc1(std::string str) { std::cout << str << std::endl; } struct X { void f(std::string str){ std::cout<< str << std::endl;} }; and these two function callers: typedef void (*userhandler_t) (std::string); struct example {...

For programming content, what simple-to-use-and-setup PHP based blog are the preferred ones?

I've since long wanted a place I can toss my programming related nuggets at. Every day I feel I solve something that I'll surely hit again in a not so distant future, but by then I most certainly will have forgotten about the previous solution I came up with. So I need to blog it down, quick and dirty, for my own documentation and memor...

Is it possible to use a DLL created using C# in an unmanaged VC++ application?

I have a DLL that I wrote in C# and I want to use it both with C# applications and applications written in unmanaged VC++. Is this possible? ...

Oracle Extended Stored Procedure with C++

I am currently adding Oracle 10.2.0. as a viable database to a product. The product originally allows connection to SQL Server and I have found some extended stored procedures. Is it possible to produce similar extended stored procedures for Oracle with C++? If so, how do I accomplish this? Example code would be much appreciated. ...

Specify template parameters at runtime

Consider the following template class class MyClassInterface { public: virtual double foo(double) = 0; } class MyClass<int P1, int P2, int P3> : public MyClassInterface { public: double foo(double a) { // complex computation dependent on P1, P2, P3 } // more methods and fields (dependent on P1, P2, P3) } The template para...

vs2008 resource editor changes rc file language

Hi all, I am doing some improvements to an application in vs2008 in c++. When i try to edit resources (for example add an entry in the string table), the vs2008 editor changes the rc file language from LANG_ENGLISH to LANG_NEUTRAL and a non english text is replaced with question marks. If i edit the rc file externally (in notepad), an...

Hold a network connection although IP address change

Hi, Is it possible to hold an open TCP connection with a client, while the IP address of the client is externally changed? For example, the connection is establishes against address X, but somewhen while the connection is open, the client-side user asks for IP renew and gets another IP address. Can the connection remains alive in this c...

Using boost::random to select from an std::list where elements are being removed

See this related question on more generic use of the Boost Random library. My questions involves selecting a random element from an std::list, doing some operation, which could potentally include removing the element from the list, and then choosing another random element, until some condition is satisfied. The boost code and for loop ...

How can I use gtkmm with MinGW (g++) without MSYS?

Hello stackoverflow members, How can I use gtkmm with MinGW (g++) without MSYS? Here is the story of my problem: I installed MinGW offline with all required packages (full install). I installed Apache Server and I copied all .tar.gz files and I created a website called sourceforge.org [localhost] and I installed automatically MinGW on Wi...

Strip OLE header information (MS Access / SQL Server)

I have a C++ application that needs to support binary database content (images, etc). When using MS Access or MS SQL Server this data is wrapped inside an OLE object. How do I strip this OLE header information? Note that I can't just look for the beginning of a specific tag as the content can be png, jpg and a whole heap of other formats...