how to open a file (ie. .txt file) in C++ (kinda like double clicking it in windows)?
I'm wondering how I can open a file literally in C++ (like double clicking it)? ...
I'm wondering how I can open a file literally in C++ (like double clicking it)? ...
Hello! How to define operator< on n-tuple (for example on 3-tuple) so that it satisfy strict weak ordering concept ? I know that boost library has tuple class with correctly defined operator< but for some reasons I can't use it. ...
//C++ Example #include <iostream> using namespace std; int doHello (std::string&); int main() { std::string str1 = "perry"; cout << "String=" << str1 << endl; doHello(str1); cout << "String=" << str1 << endl; // prints pieterson return 0; } int doHello(std::string& str){ str = "pieterson"; cout << "String="...
i have code like this string xml_path(conf("CONFIG")); xml_path+=FILE_NAME; Where, conf function returns char * and FILE name is const char * I want to combine it to one line like xml_path(conf("CONFIG")).append(FILE_NAME) how do i do it? any suggestions ?? ...
I'm developing an inference engine, this means that basically I have a certain number of "facts" which are basically the representation of the world in a certain moment. Together with the facts (that usually are only two, the starting state and the goal state) I have many rules (could literally be hundreds for certain problems). The aim ...
I am currently taking a c++ course and trying to get a deep understanding of the whole thing. I came up with some theories, it would be great if somebody could confirm them: Every variable (local,global,staic,member and non-member) is guaranteed to have its ctor called before first use The ctors of primitives like int are essentially n...
I wrote a windows service (Win32 API) that uses a .NET assembly written in C#. The service is set up to start automatically. In Windows XP all works well but under Vista the service is not automatically started (after reboot) because the .NET component is throwing an exception. But if I start the service manually, it works well. It seems...
I am changing my C++ project, which was earlier in VC6 and now being migrated to VS 2008, to use MSXML 6 instead of the earlier MSXML 3. When the code was in VC6 we were using MSXML3 by importing it # import "msxml3.dll" This was replaced with # import "msxml6.dll" After this when I compile the project I get this and several other...
There are at least two ways that I know of to write a Symbian application: 1. J2ME 2. A native application. My question is, does the SDK/API for either of those methods (or any other method) grant me (at least) read-only access to contact information (names/numbers/etc) on the phone itself? Does this in any way depend on the specific...
We have a hierarchy of exception classes - there's a GenericException class and a number of classes that derive from it. GenericException is polymorphic - it has a virtual destructor. One of derived classes is FileException thrown to indicate errors when manipulating with filesystem objects. FileException has GetErrorCode() method that ...
how to close or discard a MFC dialog box Automatically after 10 seconds. ...
Hi there IMHO to me OOPS, design patterns make sense and i have been able to apply them practically. But when it comes to "generic programming /meta programming" of the Modern C++ kind, i am left confused. -- Is it a new programming/design paradigm ? -- Is it just limited to "library development"? If not, What design/coding situatio...
I want to hide an external application, ie. not the current application. I want to give the title of the application and it will be hidden. How can I do this programmatically? ...
This is actually a solved problem, but it's so esoteric I thought I'd share it for other users. Also perhaps others might suggest reasons? Anyway, I'm working on a "mixed mode" .NET application written in managed C++, but with heavy links into existing native libraries. The problem was, unhandled managed exceptions ended up as Win32 A...
I've setup a std map to map some numbers, at this point I know what numbers I'm mapping from an to, eg: std::map<int, int> myMap; map[1] = 2; map[2] = 4; map[3] = 6; Later however, I want to map some numbers to the lowest number possilbe that is not in the map, eg: map[4] = getLowestFreeNumberToMapTo(map); // I'd like this to return...
In C++ it's possible to use a logical operator where a biwise operator was intended: int unmasked = getUnmasked(); //some wide value int masked = unmasked & 0xFF; // izolate lowest 8 bits the second statement could be easily mistyped: int masked = unmasked && 0xFF; //&& used instead of & This will cause incorrect behaviour - masked...
With reference to this question, could anybody please explain and post example code of metaprogramming? I googled the term up, but I found no examples to convince me that it can be of any practical use. On the same note, is Qt's Meta Object System a form of metaprogramming? jrh ...
I am just starting to use boost::ptr_vector. I have a ptr_vector pctr as a member of one class A and want another class B to refer to an element in pctr. While constructing an object of class B I want to store a pointer in pctr. Since pointer containers do not allow access to the pointer (but only to references), I must take the addres...
Say I have a function like this: inline int shift( int what, int bitCount ) { return what >> bitCount; } It will be called from different sites each time bitCount will be non-negative and within the number of bits in int. I'm particularly concerned about call with bitCount equal to zero - will it work correctly then? Also is ther...
Is there a compiler that has good support for the new C++0x? I use GCC but unfortunately the current version 4.4 has a poor support for the new features. ...