c++

Example of using UDP in obj-c/C++?

Hey, I'm making an iOS app - real-time game, wanna use UDP protocol. I'm searching a lot for examples/guides, but can't find any. Also, the software on the server will use C++, and I've searched a lot and can't fina a nice way to use it, for begginers in C++... I found that: http://developer.apple.com/mac/library/samplecode/PictureShar...

C++ How do I use an onClick event to create a textbox?

I'm trying to create a visual c++ application which has a button that when clicked creates a text box, and when clicked again creates a text box underneath the last one created. Then a button which deletes the previously created text box. Where do I start? Does anyone have any samples of this? Thank you! ...

mmap SIGSEGV when memory map is to a class member and modified outside the class

I have a very simple class that opens a file and creates a memory mapped file. The region is mapped to the member variable called data_ which is defined as unsigned char* data_; The memory map part looks like this: // Create memory mapped file unsigned char* data_ = (unsigned char*)mmap(NULL, 1024, PROT_REA...

How else can I check the user for a program?

Currently, my friend has a program that checks the users Windows CD-Key and then it goes through a one way encryption. He, then, adds that new generated number to the program for checking purposes and then he compiles it and then he sends it off to the client. Is there a better way to keep the program from being shared utilizing PHP som...

How to use pass-by-reference arguments of template type in method templates?

Hello everyone, I am currently struggling to get the following code to compile. First the header file containing a class with a method template: // ConfigurationContext.h class ConfigurationContext { public: template<typename T> T getValue(const std::string& name, T& default) const { ... } } Somew...

C++ and graphics

I have searched the web for information on creating GUIs(Games, Forms etc) in c++, I have found that OpenGL, Direct X and .Net framework can do this. The question I ask is which one is better to learn, what library for GUI in c++ is the most popular in industry. I know this is a newbie question, but if some on could lead me to the correc...

Qt4: Read Default mimeData from QAbstractItemModel

What I want to do is very similar to this. Except that I am working with a QAbstractItemModel that has a tree structure and am interested in more than just the row and column. In fact, in my model, column is always 0. But in order to implement drag and drop, I need to get the parent, children, and the opaque pointer that internalPoint...

Convert managed String (C#) to LPCOLESTR (C++)

Hello, I wave a method in C++ that receives a parameter of the LPCOLESTR type. I'm accessing this method through C#, but I can't make the correct conversion between String and this type. Let's say the method signinature in C++ is: void Something(LPCOLESTR str) In C#, I'm trying to call it (all reference issues to access the method th...

mfc directory picker?

I did see this to modify CFileDialog (http://support.microsoft.com/kb/105497) but it looks like a lot more than I need. I'm using the CFileDialog to pick files, is there a simple way to use it to just select a directory? Any other suggestions? (I also saw this but is for XP only? http://msdn.microsoft.com/en-us/library/aa16394...

Why only one object gets constructed but multiple objects are destroyed when using functor?

The following example, beats me. I've been so far thinking, that when functor is being used, the object gets constructed once and the same object is used multiple times, when used with for_each algorithm and that seems to be correct. However, even though, only one object gets constructed, but multiple objects are destroyed. Now, this b...

how can i solve binary system in c++?

how can i see the answer when i need to solve the decimal code to binary code? ...

Error while compiling C++ file using clang

After building CLang on the linux environment I tried to build it on Windows using Visual Studio. Everything went right but when I tried to compile this classic Hello World! program #include <iostream> int main() { std::cout<<"Hello World!"; } I got many errors C:\Users\SUPER USER\Desktop>clang++ a.cpp In file included from a.cpp...

What are gcc on linux's equivalent to microsoft's critical sections?

The Microsoft Visual C++ compilers have the EnterCriticalSection and ExitCriticalSection objects to allow for synchronization between threads. What is the GCC equivalent? I see references around to __sync_synchronize along with __scoped_lock In fact I see mention of a number of atomic __sync functions along with a number of __atomic o...

Meaningful diagnostic messages

Hi, Looking at several posts, I get a feel that many of the questions arise because compilers/implemenetation do not emit a very meaningful message many times (but not always). This is especially true in the case of templates where error messages could be at the least very daunting. A case in point could be the discussion topic Therefo...

problem about cscope index hpp file

i have template class A, the definition is in a.hpp a.h template <...> A { void Test(); }; #include a.hpp if let cscope -bq a.h then cscope can find Test declaration, but cannot find definition. if let cscope -bq a.h a.hpp then cscope even cannot find Test declaration. any advice? thank you. ...

strange C++ warning

certain compiler, derived from EDG gives me expression has no effect warning on this line return 1 << ((i == j) + (k == l) + ((i == k) & (j == l))); values are runtime values, compiler does not know them. return 1 << (((i == k) & (j == l))); // no warning here return 1 << ((i == j) + (k == l)); //or here am I missing something or i...

C++ function return scope and reference

Hi, recently I am learning C++ and have some doubt on the following case. void function_a(const int &i){ //using i to do something } int function_b(){ return 1; } ok, if I am going to call... function_a(function_b()); is there any chance that function_a read dirty reference from the it's param? Thank for your time. ...

LGPL Machine Learning with Random Forest - C++

I am looking for a library with following features: Minimalistics with Random Forest learning and classification LGPL licenced In C++ CMake build system - not compulsory So far Waffles looks good, any other contenders ? ...

Socket Programming in C++

Hi, Can anybody provide me some sample example on Client and server connection using sockets in C++. I have gone through some tutorials now i want to implement it. How to start ? ...

overloading new and delete in c++

HI All, I was trying to overload new and delete to fix a memory leak problem in my project. But got stuck with some compilation error. Currently this code is bit shabby Here is my hdr file #include <cstddef> #include <iostream> #include <list> #include <stdarg.h> #include <stdio.h> using namespace std; typedef unsigned int DWORD; vo...