Easily initialise an std::list of std::strings?
In C++0x, what I want would be: std::list<std::string> colours = {"red", "blue", "green", "grey", "pink", "violet"}; What's the easiest way in standard, non-0x C++? ...
In C++0x, what I want would be: std::list<std::string> colours = {"red", "blue", "green", "grey", "pink", "violet"}; What's the easiest way in standard, non-0x C++? ...
I'm trying to learn how to write Windows GUI* programs in C++, using Visual Studio 2008, but I haven't found any more comprehensive tutorial for beginners. The more comprehensive tutorials I have found are either only about how to make buttons, menus, etc. OR only about how to write basic C++ console programs. What I haven't found is a...
I have a fairly complex set of C++ classes that are re-written from Java. So each class has a single inherited class, and then it also implements one or more abstract classes (or interfaces). Is it possible to use qobject_cast() to convert from a class to one of the interfaces? If I derive all interfaces from QObject, I get an error due...
Hi, I am new in programming and I would like to know if it is possible to convert an XML node to a C++ Structure. For instance I have a file with the following XML: <?xml version="1.0" encoding="utf-8"?> <StrucDescription> <StrucName> <unStrucNameMember1 type="uint16">0</unStrucNameMember1> <unStrucNameMember2 type="uint8">0</...
Hello, I need to convert a QChar to a wchar_t I've tried the following: #include <cstdlib> #include <QtGui/QApplication> #include <iostream> using namespace std; int main(int argc, char** argv) { QString mystring = "Hello World\n"; wchar_t myArray[mystring.size()]; for (int x=0; x<mystring.size(); x++) { my...
My friend is learning Norwegian and i want to make a global hot key program which sends keys such as æ ø å My problem is that keybd_event function wont allow me to send those keys, i seem to be restricted to the virtual key codes is there another function that i could use or some trick to sending them? ...
Possible Duplicate: Inline functions vs Preprocessor macros hello can somebody please explain what exactly does it mean, and what is the difference from regular macro(I know that it works during compile time and not preprocessor but so what?) thanks in advance for any help, looked in google but didn't find something understand...
There are lots of examples of sending integers to C++ from R, but none I can find of sending strings. What I want to do is quite simple: SEXP convolve(SEXP filename){ pfIn = fopen(filename, "r"); } This gives me the following compiler error: loadFile.cpp:50: error: cannot convert 'SEXPREC*' to 'const char*' for argument '1' to 'FI...
Hello, I want to write data to a file in a directory i.e. path_file = "/Users/aajd/2010M9/2010M9.txt"; std::ofstream outFile(path_file); The name of the file and the path to the file is dependent of the outcome of the program. How can i accomplish this? Is it necessary that the directory already exists? Thanks, André ...
Is there a way in Windows (which works in Windows CE) to check if a printer is attached and communicating to LPT1 in C++? [Edit] More info: We are currently working with a generic Windows CE printer driver - pcl.dll - by passing it into CreateDC, to get the DC for the printer. We can't call PrintDlg() to show the print dialog becaus...
Hello! I am working on my own 3d engine and have the following question: I have an abstract object, that handles geometry (vertices and faces). It uses internal storage for this geometry, allows editing and my renderer object has a method RenderGeometry. With this design my rendering process includes a geometry caching step. So, rende...
I used to see Sleep(0) in some part of my code where some infinite/long while loops are available. I was informed that it would make the time-slice available for other waiting processes. Is this true? Is there any significance for Sleep(0)? Thanks. ...
Hi, I need to create a c++ add-in to mathlab where add-in will listen to packet coming from network and notify mathlab to draw an packet analysis graph. I understood that using a MEX file I can easily call c functions inside mathlab, but I could not find a way to notify mathlab when data is available at c++ end. Is there any way we can ...
Here's my error. dyld: Symbol not found: __ZTIN8eqOsirix3ROIE Referenced from: /Users/slate/Documents/osirixplugins/CoreDataTrial_EQOsirix/build/Development/rcOsirix.app/Contents/MacOS/rcOsirix Expected in: flat namespace in /Users/slate/Documents/osirixplugins/CoreDataTrial_EQOsirix/build/Development/rcOsirix.app/Contents/MacOS/rc...
I have an approach to call delayed function for class: //in MyClass declaration: typedef void (MyClass::*IntFunc) (int value); void DelayedFunction (IntFunc func, int value, float time); class TFunctorInt { public: TFunctorInt (MyClass* o, IntFunc f, int v) : obj (o), func (f), value (v) {} virtual void operator()(); protected: ...
Visual Studio keeps trying to indent the code inside namespaces. For example: namespace Test { void Testing(); void Testing() { } } Now, if I un-indent it manually then it stays that way. But unfortunately if I add something right before void Testing(); - such as a comment - VS will keep trying to indent it. This is s...
I am currently involved in developing a low level network application. We have lately run into the issue of error reporting concerning both user land and debug land. Given that some errors might fire up from lower level functions, libraries ... reporting the exact error status (code, messages, env...) from one layer to another higher lay...
I am trying to compile ncurses-5.7 from source and after running ./configure I get the following error: configure: error: Your compiler does not appear to recognize prototypes. You have the following choices: a. adjust your compiler options b. get an up-to-date compiler c. use a wrapper such as unproto how can...
Hi, I would like to debug a c++ source in Eclipse CDT but I still get this error message: Error while launching command: gdb --version I have gdb 7.2. installed Thank you for your advise. ...
i am creating a application in which i need to change the layout of my current tab when a radio button is pressed but i am not getting how to do it. can any one tell me the right way? I am using the following code to change layout. changed_layout=new QVBoxLayout; label1=new QLabel(string); delete main_layout; changed_layout->addWidget...