In how many ways we can take input values in C++ ??
How to take input values in C++, in how many ways we can take input values.? Please describe in brief with small examples ...
How to take input values in C++, in how many ways we can take input values.? Please describe in brief with small examples ...
I need to insert pointers of classes (inherited from QObject) into a QList. I know that the following syntax can be used: .h QList<MyObject*> list; .cpp list.append(new MyObject("first", 1)); list.append(new MyObject("second", 2)); ... and then free memory: if(!list.isEmpty()) { qDeleteAll(list); list.clear(); } This sh...
Hi, I wrote a thread-safe(at least the aim is that) container class in C++. I lock mutexes while accessing the member and release when finished. Now, I try to write a test case if it is really thread safe. Let's say, I have Container container and two threads Thread1 Thread2. Container container; Thread1() { //Add N items to the co...
I think this is a very simple question, but when I copy an image I can't paste it in a QTextEdit? Paste is inactive! Also I would like to know how to drag-and-drop a picture. BTW I use the following code in order to insert a picture into a QTextEdit: QTextEdit *textEditor = new QTextEdit(0); QTextDocumentFragment fragment; fragment = Q...
I have a project to scan some QR-code or bar-code with camera on windows mobile. (phone x01t) Programing in C++ and using DirectShow. Tired to change focus with IAMCameraControl interface, but return the error like "...request is not supported". Are there any way else? Thanks ...
This question I have asked before and just got answer that there is an open bug for this. But this is a really required feature and, I guess, each Qt programmer who programmes a more or less serious application, it is quite probable that there is used a QTextEdit and the data is inserted in QTextEdit is serialized and deserialized. Thus ...
While trying to compile program, that uses zlib, i got following errors: Error 1 error LNK2019: unresolved external symbol _compress referenced in function "void __cdecl save_image_in_pakfile(class std::basic_ofstream > &,struct _IplImage *)" (?save_image_in_pakfile@@YAXAAV?$basic_ofstream@DU?$char_traits@D@std@@@std@@PAU...
Hello to all, can anyone show example code before and after to avoid down casting for visitor pattern code ? Thanks. ...
I have a fairly large solution that occasionally crashes. Sadly, these crashes appear to only occur in release build. When I attach the debugger upon crashing, I get the message: "No symbols are loaded for any call stack frame. The source code cannot be displayed" This makes it quite hard to find the cause of the crashes. I am ...
Can I create an object of a class at runtime, by extracting the class name stored in a string? eg: I want to create and object of class QButton like QString strClassName = "QButton"; QButton *pBtn = new strClassName(); I want to read an xml file of all the controls and instantiate them at runtime using this way. Thanks! ...
I want to iterate over each pixel color in a jpg format image, which library should I refer to to do this so that the code can be as short as possible? ...
Dear all, Our Windows C++ Ogre-based game is nearing completion. Before we publicly release it, we have to solve this matter : Ogre crashes on many test-computers if they are not updated to the latest Dx9.0c version. All these computers already had 9.0c installed, but that must have been an older OS-pre-installed sub-version, hence the...
What will be the output if I write In C++ if(5) will be executed without any problem but not in C# same way will it be able to run. if(func()){} //in C# it doesn't runs Why how does C# treats void and how in Turbo C++ void func() { return; } if(null==null){}//runs in C# EDIT if(printf("Hi"){} //will run and enter into if statemen...
Hello! I'm slightly confused with template specialization. I have classes Vector2, Vector3 which have operator+= in it (which are defined the following way). Vector2& operator+=(const Vector2& v) { x() += v.x(), y() += v.y(); return *this; } Now I want to add the generic addition behaviour and say something like: ...
Hi there, I am new to openGL and wanted to set the text color tried the glColor3f function but it changes the drawing color as i only want to change the text color what should i do? ...
Possible Duplicate: Create new C++ object at specific memory address? I am writing what is essentially an object pool allocator, which will allocate a single class. I am allocating just enough memory to fit the objects that I need, and I am passing out pointers to spaces inside. Now my question is this: Once I have gotten a ...
Possible Duplicate: Are there binary memory streams in C++ Oops - http://stackoverflow.com/questions/1559254/are-there-binary-memory-streams-in-c ...
Hi, due to my lack of english skills, I'm going to try to explain what I mean using a few examples: socket() -> WSASocket() connect() -> WSAConnect() send() -> WSASend() sendto() -> WSASendTo() recv() -> WSARecv() recvfrom() -> WSARecvFrom() ... closesocket() -> WSA???() This is nothing that matters much, still something that gives ...
I'm working with a large code base which uses const strings in structure initializers. I'm trying to translate these strings via GNU gettext with a minimal amount of time. Is there some sort of conversion operator I can add to default_value which will allow Case #1 to work? #include <cstring> template<int N> struct fixed_string { c...
I'm trying to understand the syntax used in STL for a class. Our teacher pointed us to this website (http://www.sgi.com/tech/stl/Map.html) where I copied the code below: struct ltstr { bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) < 0; } }; int main() { map<const char*, int, ltstr> months; ...