c++

Win32 equivalent of getuid()

Hi.. I'm in the process of porting a C++ library from Linux to Windows, and am having problems with getuid(), which is not supported in Windows. Any ideas what I can use in its place? ...

Msvcr90d.dll not found when building in RELEASE

It's strange, if I build my program in debug mode, I have no errors, but if I build my program in released mode, I get an error saying that Msvcr90d.dll is not found. Msvcr90d.dll is a debug library, I'm not sure why it's coming up when I load it for release =/ ...

Is std::string thead-safe with gcc 4.3?

I'm developing a multithreaded program running on Linux (compiled with G++ 4.3) and if you search around for a bit you find a lot of scary stories about std::string not being thread-safe with GCC. This is supposedly due to the fact that internally it uses copy-on-write which wreaks havoc with tools like Helgrind. I've made a small progr...

Convert float array image to a format usable for opencv

Hi, i wonder if there is a easy way to convert my float array image to iplimage, which can be handled by opencv. Of course i could create an empty iplimage with the same size and just copy ever pixel from my float array image to the emplty iplimage, but is there more elegant solution to this. Maybe a faster less memory consuming method,...

Which language to use for implementing few Linux shell commands (homework) - plain C or C++?

I need to implement a few commands of Linux shell for my homework - 5 or 6 of them, including ls. Do not know much about which parameters to implement for each of commands... I planned to use C++, but when I asked my colleague for advice what language to choose - plain C or C++, he said that interpreter was not a program in traditional ...

What is a good book/guide for socket programming in C?

Could anybody please tell me which is best guide/book/material for socket programming in C? I am reading beej's guide for network programming but it just gives an overview. Can you suggest any other books or guides? ...

[C++] Web Browser in an Irrlicht application?

Hello there, I'd like to know whether I can embed a web browser control into my Irrlicht (http://irrlicht.sourceforge.net) application. A simple HTML renderer or maybe a trick to embed an Internet Explorer ActiveX control into my Irrlicht application is just OK. Is it possible? If so, how? Any kind of help would be greatly appreciate...

Quick way to locate all sub-classes that override a certain function?

I have a base class that declares a virtual function, and a large set of subclasses that inherit from the class, some of which may override the function. Now I need to alter the behavior of the base function (make it non virtual and move the overridable functionality to a different place), and I wonder if there's a quick way to locate al...

How could a pointer to a structure be an array?

This is really a noob quick question. Imagine you have a struct called "No" and the following piece of code: No *v_nos; // What does this mean? Where I took this from they were calling "v_nos" a array? Isn't it simply a pointer to a struct "No"? Thanks. ...

How to implement automatically select item in a html and click submit ?

I have a website, and username and password, and usually I will login the website with the username and password, and select some items in check boxes and submit them to execute actions. but right now i need to write a application to select the checkbox by some keywords and submit them automatically. Do anyone have good idea ? I used ...

how does the stl's multimap insert respect orderings?

I have some data which come with a integer index. I am continuous generating new data which needs to added to the collection of data I have, sorted by that index, at the same time I want to easily be able to go the start of the data and iterate through it. This sounds like std::multimap is just what I need. However, I also need data w...

syncing iostream with stdio

I am trying to add iostream to the legacy code and thus want to sync those two libraries. According to this article, I should use std::ios_base::sync_with_stdio. Now, I wonder how it is used in practice (examples please), side-effects I should be aware of. Thx ...

User Interface clarifications

Hi all! As you know, many programs are written in C++. Some of these have fancy GUI with non-classical-Windows style ( think to Photoshop, 3ds max, maya etc )..now my question is: how are they done? In pure Win32 API? MFC? DirectX/OpenGL? or other? I can reach similar results with C#/WPF but how can I do it in C++? Thank you in advance ...

C macro : turn a number into a string

I have a table that defines symbols appearance on a 5x7 dot display. Something like: extern UINT8 symbols[][5] = { {0x0,0x0,0x0,0x0,0x0}, {0x0,0x0,0x5F,0x0,0x0}, {0x0,0x7,0x0,0x7,0x0}, {0x14,0x7F,0x14,0x7F,0x14}, // etc. The leading part of the table matches ASCII table, followed by a set of special symbols, e.g. an ...

C++ templates problem

I have defined a generic tree-node class like this: template<class DataType> class GenericNode { public: GenericNode() {} GenericNode(const DataType & inData) : mData(inData){} const DataType & data() const { return mData; } void setData(const DataType & inData) { mData = inData; } size_t getChildCount() ...

Borland C++ 5.02 & Windows 2003 Server

Firstly, I am not very familiar with C++ at all, let alone Borland. However I have been tasked with migrating our builds from an aging Windows 2000 box onto a Windows 2003 box. I have a problem with a C++ build. When built on 2000 or XP, the compiled DLL works fine when tested. However the output from the Windows 2003 box does not work...

Why is non-type template parameter expression handling inconsistent across compilers?

Here is something I observed across various compilers. It seems there are compiler bugs. template <int I> struct X { }; int main(void) { X<(16 > 1)> a; // Works on vc9, works on g++ 4.1.2, works on Comeau 4.3.10.1 X<(int(16) > 1)> b; // Works on vc9, works on g++ 4.1.2, works on Comeau 4.3.10.1 X<(16 >> 1)> c; // Work...

Inlining std::inner_product

Allegedly inlining std::inner_product() does NOT get inlined with gcc compiler < gcc 4.1 compilers, per the following bug . Hence I would like to implement my own version of inner_product. Are there existing implementation available? Thanks ...

How to change the color of a textual cue when sending an EM_SETCUEBANNER Message ?

When you send an EM_SETCUEBANNER message, you get a grey textual cue in your edit control. How to change the color the textualcue in Win32/C ? ...

"Don't show this again" option in message boxes

In C++/MFC, what's the simplest way to show a message box with a "Don't show this again" option? In my case, I just want a simple MB_OK message box (one OK button). ...