c++

Get the number of visible chars on a line before the cursor, programatically im Microsoft Word, using C++

A bit of background: My program reads text from a number of applications so that handicapped or children can hear it. To do this, it has an internal buffer where the text is, and an internal representation of where the cursor is. So, if the cursor is | the result for this line would be 21 (or thereabouts) :) Now, to get the cursor posi...

Does C++ have standard queue?

I know that there's a standard library vector in C++. Is there a queue? An online search suggests there might be, but there's not much about it if there is one. Edit: All right. Thanks a ton guys. ...

C++ : has_trivial_X type traits

The boost library, and it seems the upcoming C++0x standard, define various type trait templates to differentiate between objects which have trivial constructors, copy constructors, assignment, or destructors, versus objects which don't. One of the most significant uses of this is to optimize algorithms for certain types, e.g. by using ...

Enumerating computers in NT4 domain using WNetEnumResourceW (C++) or DirectoryEntry (C#)

I'm trying to enumerate computers in NT4 domains (not Active Directory) and support Unicode NetBIOS names. According to MSDN, WNetEnumResourceW is the Unicode counterpart of WNetEnumResource which to me would imply that using this would do the trick. However, I have not been able to get Unicode NetBIOS names properly using WNetEnumRes...

Problem with std::multimap

Heya I've got the following : enum Type { One = 0, Two}; class MySubClass { private: MySubClass(); // prohibited MySubClass(const MySubClass&); // prohibited MySubClass & operator (const MySubClass&); // prohibited public : MySubClass(int x); }; class MyClass { MyClass(int x) : m_x(new SubClass(x)) {} ~MyClass() { delete m_x; } p...

VC++ compiler for Qt Creator

Hi, I want to use the VC++ toolset to build programs for XP and Vista, but I do not want to buy the IDE, because I want to use Qt Creator. I would download the Windows SDK and the Windows Debugging Tools, but I'm not sure if this includes everything that I need (i.e: compiler, linker, nmake, debuggers). Has anyone used this approach? H...

What is the best solution to replace a new memory allocator in an existing code?

During the last few days I've gained some information about memory allocators other than the standard malloc(). There are some implementations that seem to be much better than malloc() for applications with many threads. For example it seems that tcmalloc and ptmalloc have better performance. I have a C++ application that uses both mall...

OUT OF MEMORY only when virtual limit is hit?

As I know in win32 every program receives say 4GB of virtual memory. Memory manager is responsible for offloading chunks of memory from physical memory to disk. Does it imply that malloc or any other memory allocation API will throw OUT_OF_MEMORY exception only when virtual limit is hit? I mean is it possible for malloc to fail even i...

Defining own main functions arguments argc and argv

Hello everyone, i want to create an object of type QApplication which needs the main functions arguments argc and argv as an input: QApplication app(argc, argv); Since i am within a user defined function without access to the main function i want to define this arguments on my own. I have tried several approaches but i cannot get the...

Custom WM profile - issues with codec

Hello I create my custom WM encoder profile. The reason I need a custom, non standard WM profile is that I need that the video resolution must be the same as input video stream. I created below profile but after I encode my video and audio with it, the WMP while loading says that the WMV1 codec is not found and prompts me for downlo...

How do I initialize number with NaN in Borland C++?

How do I initialize number with NaN in Borland C++? duplicate: Using NaN in C++? ...

How to get this getnameinfo code working

i am getting the error ai_family not supported in call to getnameinfo. 1 #include <iostream> 2 #include <sys/types.h> 3 #include <unistd.h> 4 #include <sys/socket.h> 5 #include <netdb.h> 6 #include <arpa/inet.h> 7 #include <iomanip> 8 extern "C" { 9 #include "../../pg/include/errhnd.h" 10 } 11 12 using namespace st...

C++ DAL - Return Reference or Populate Passed In Reference

Hi, [EDIT 1 - added third pointer syntax (Thanks Alex)] Which method would you prefer for a DAL and why out of: Car& DAL::loadCar(int id) {} bool DAL::loadCar(int id, Car& car) {} Car* DAL::loadCar(int id) {} If unable to find the car first method returns null, second method returns false. The second method would create a Car objec...

how to write a text editor in c++

Hi Guys, I learned c++ on and off for serveral times but never write a real apps using it . long time I've been thinking that writing a text editor will be something very interesting , now I am looking for a simple but decent text editor written in c or c++ from which I can get inspiration and learn how to write a text editor by myself....

C++ version of isnormal()

Is there a C++ version of the isnormal, isnan and so C functions? I know I can use the C functions from C++, but I'm always interested to know if there are some C++-only alternatives. ...

Open another user registry settings

Hi all, I want to write a application that writes to all users on a local machine a specified key (eg: i want set the location for IE Favorites for all users to the same folder) PS anybody used these functions? LoadUserProfile RegOpenCurrentUser CreateProcessAsUser ...

When to use run-time type information?

If I have various subclasses of something, and an algorithm which operates on instances of those subclasses, and if the behaviour of the algorithm varies slightly depending on what particular subclass an instance is, then the most usual object-oriented way to do this is using virtual methods. For example if the subclasses are DOM nodes,...

Where do I use BackTrace calls on the Mac

I want to get a BackTrace from my crashing C++ Mac application however I am new to the Mac and am not sure how best to go about it. I found a question on stackoverflow that details its usage: getting the current stack trace on mac os x However my problem is that I do not see where the code is meant to live? Does it go in the main.cpp...

Suggested second-step textbook for self-educating programmer?

I'm currently giving myself a self-taught crash course in computer science, half for fun and half for continuing education. I'm just about finished with John Zelle's Python Programming: An Introduction To Computer Science (http://amzn.com/1887902996), and now I'm looking for a second book to pick up for when I do finish this one. Just ...

What libraries are available for parsing c++ to extract type information

I'm looking for a way to parse c++ code to retrieve some basic information about classes. I don't actually need much information from the code itself, but I do need it to handle things like macros and templates. In short, I want to extract the "structure" of the code, what you would show in a UML diagram. For each class/struct/union/enu...