c++

C++ or Python (maybe else) to create GUI for console application in C

I have a Visual C console application (created in VC++2008EE) and I need to add GUI to it. One idea was to invoke the console app as a subprocess and communicate with it using stdin and stdout. I tried to do that with Python subprocess module - but it deadlocks (probably because my console app is running continuously). As I understood f...

Time for deleting pointers

Hei community, I've got a small question concerning the deletion of pointers. I am working with pointer-to-pointer matrices of Dimension 1024x1024. Since I am creating them dynamically, I delete the allocated space for them at the end of the program. But doing this in the usual loop costs quite a lot of time - I measured about 2sec usi...

COM DLL - Overlay Icon

Hi, I have created a COM DLL to apply Overlay icon for file/folders. If I open a folder, IsMemberOf() function has been called for each files. And I can determine whether icon to be set for the particular file by querying the db at run time based on file status. (I will update the file status in db say modified/added similar things) ...

Modifying a file from within an executable - permission denied in XP (but not Vista)

I have an application where I need to open an xml file, modify it, and close it again. When I test the code on a laptop running Windows Vista, it works perfectly, but under Windows XP I can't even open the file for read/write access: errno_t _wfopen_s(&inStream, m_fileName, L"r+, ccs = UTF-8"); ...without getting an error code 13, "Pe...

what is the difference between c++ and MFC

what is the difference between c++ and MFC(except front end designing concept) ...

How to receive and decode SNMP traps in a C (or C++) application?

I am trying to write a very small SNMP trap receiver, listening to UDP port 162. Traps come in fine, but I can not decode them. I have found libber, but it can't decode the traps for some reason. I am probably using it wrong. I imagine decoding an SNMP trap should be fairly simple and that I am missing something crucial. Is it possibl...

When to use DBL_EPSILON/epsilon

The DBL_EPSILON/std::numeric_limits::epsilon will give me the smallest value that will make a difference when adding with one. I'm having trouble understanding how to apply this knowledge into something useful. The epsilon is much larger than the smallest value the computer can handle, so It would seem like a correct assumption that it...

Returning after throwing exceptions

Is it in any way beneficial to return a value after throwing an exception? If not, can the return statement be left out and is it somehow possible to remove compiler error C4715: not all control paths return a value? Thanks in advance. Edit: (sample code) for (ushort i = 0; i < itsNumUnits; ++i) if (unitFormation[i] == unit) {...

What do I need to download to use MFC without Visual Studio?

I've got Visual Studio 2008 express, and I need to use afx.h and some other things from MFC. Is there an SDK I can download that includes those? I downloaded the latest Windows SDK, but that didn't include it. Thanks. ...

XML parsing error on symbian s60

Hi! I have a problem with Carbide C++. I'm trying to use function from Nokia Forum to read xml files. So I found this article: http://wiki.forum.nokia.com/index.php/How_to_parse_XML_file_using_CParser_class and I've created a XmlHandle.h and XmlHandle.cpp files. But I don't know how I can use this. I try something like this: _LIT( KCon...

What is the purpose of forward declaration?

what is the description or meaning of this: for example: class test; class test { ..... }; ...

Take care about precedence of * and ++ in C/C++, (and any keystroke when programming)

Somebody write this function void strToUpper(char *p) { while (*p) { *p = TOUPPER(*p); *p++; //<-- Line to pay attention } } I asked, why do you put the * before p++? answer: because "It's the same", I corrected the code and then stay angry for a while, because both really work the same... void strToUpper...

stringstream issue

I cannot get the following stringstreamm to compile stringstream qss; qss.operator << "some text " ::stringstream.operator << DDateTime::date2Oracle(dFrom) ::stringstream.operator << " more text " ::stringstream.operator << DDateTime::date2Oracle(dUntil); If I just use the << operator without the ::stringstream.operatorit complain...

Programmatically check if IPv6 is enabled on windows

Is there a way to programmatically check if IPv6 is installed/enabled on windows using c++? Either at an interface level, or system wide. ...

How to check a "NULL object reference" in Managed C++ ?

Hi there, I come across some MC++ code like this: __gc class ClassA { Puclic: ClassB GetClassB(); } __gc class ClassB { Public: int Value; } int main() { ClassA^ a = gcnew ClassA(); ClassB^ b = a->GetClassB(); int c = b->Value; } Isn't it important to check whether b is NULL before access to its value? I trie...

Doxygen integration with (unmanaged) Visual C++ 2005

We are slowly moving towards better-standardized commenting in a large C++ project, introducing Doxygen. I personally find it a pain typing in comments, especially since Java IDEs are so good at automating this. So I wondered what tools there might be? A search turned up DoxyComment which looks quite nice, is this the best/standard tool...

Reading/Writing Nibbles (without bit fields) in C/C++

Hello all, Is there an easy way to read/write a nibble in a byte without using bit fields? I'll always need to read both nibbles, but will need to write each nibble individually. Thanks! ...

C++: Compiler complains about variables initialization in constructor

Hi, I have in my header "Test.h" a variable of a class that doesn't have a constructor without arguments. And I have a constructor like this: Test::Test() // <-- Here he complains: // error: no matching function for call to ‘Beer::Beer()’ { int i = 2; theVar = Beer(1, i); // Beer(int, int) is the only constructor } ...

C++ Reorganizing an array to fill in the gaps?

I'm not sure if the word Reorganizing is the correct term, but its the only way I can describe what I'm looking for. If I have an array of say, Cats, like so: CAT *myCats[99]; myCats[0] = new CAT; myCats[1] = new CAT; myCats[2] = new CAT; myCats[3] = new CAT; myCats[4] = new CAT; myCats[5] = new CAT; At one point in time, lets say m...

how can i load BitmapEx.h

I am working on MFC with c++. i got this error: Cannot open include file: 'BitmapEx.h': No such file or directory. plzz tell me how can i include it. ...