c++

problem in accepting connection from client (socket programming) in VC++.net

Hi Jerry, I have corrected the above syntax error i am having the same problem. nothings appears on my end can u tell me how u are executing the code. i am executing it by simple running first the server and then client in visual stdio 2005. ...

Laser light detection with OpenCV and C++

Hi all, I want to track a laser light dot(which is on a wall) with a webcam and i am using openCV to do this task. can anybody suggest me a way to do it with C++. Thank you ! ...

constructor with one default parameter

Suppose I have a class class C { C(int a=10); }; why if I call C c; the contructor C(int =10) is called and if I call C c(); the default constructor is called? How to avoid this? I want to execute only my constructor, I tried to make the default constructor private, but it doesn't work. ...

Problem on Mac : "Can't find a register in class BREG while reloading asm"

I tried to port some code onto Mac OS X. The program uses the "ttmath" library, a header big-num header library. This library works fine on both windows and linux, but when I try to compile and run it on a Mac, the following error message always shows up : "can't find a register in class 'BREG' while reloading 'asm'". I found some d...

RegisterClass fails with Error Code 2

I am creating a splash for a program that I'm making but RegisterClass keeps on failing (2: The system cannot find the file specified.) My code is this: WNDCLASS wc = {0}; wc.lpfnWndProc = DefWindowProc; wc.hInstance = g_hinstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); if (wc.hCursor == NULL) { #ifdef DEBUG log_debug("ShowSplas...

General use cases for C++ containers

What are the general use cases for the C++ standard library containers? bitset deque list map multimap multiset priority_queue queue set stack vector For example, a map is generally better for a paired search. ...

Does C++ have good libraries to accelerate Windows Forms like software?

Hi Suppose you have to develop a software to access customer database, let's say for example "SQL Server". Are there good libraries to accelerate this job in order to give to my client a good UI? For example, I could show a grid where he can select his desired customer for updating and deleting existing customers data, also offer a bl...

how Adobe write PhotoShop cross-platform ?!

how Adobe write PhotoShop cross-platform ?! I want just know how Adobe make PhotoShop cross-platform?, i know PhotoShop is writed completely in C++, but what about GUI ? Adobe use GUI toolkits ? ...

back_insert_iterator with remove_copy_if

I am trying to use a back_insert_iterator with remove_copy_if using vectors but I have compile errors. Do you know why the code below is wrong? #include <iostream> #include <string> #include <algorithm> #include <cassert> #include <vector> #include <iterator> #include <functional> struct checkRem : std::unary_function<int,bool> { ...

C++: error: expected primary-expression

void add(int register, int& acc) { acc += register; } main.cpp:124: error: expected primary-expression before ‘register’ wth is wrong right there? ...

fstream to const char *

What I want to do is read a file called "test.txt", and then have the contents of the file be a type const char *. How would one do this? ...

Comparing doubles

I'm writing a program that consists of a while loop that reads two doubles and prints them. The program also prints what the larger number is and what the smaller number is. this is the code i have so far. int main() { // VARIABLE DECLARATIONS double a; double b; while (a,b != '|') ...

Pure GUI apps for Win/Linux/Mac in C++ with G++

GUI apps for Win/Linux/Mac in C/C++ Please, i want know how to write a "pure" "native" "API-level" apps for Windows and Linux and Mac in C++. I don't want one-code run-anywhere, but a native code for every OS Solution For Windows Just use Mingw/Win32 API, its very simple!, very clear, and that way i like programming under Windows!. ...

accessing protected members of superclass in C++ with templates

Why can't a C++ compiler recognize that g() and b are inherited members of Superclass as seen in this code: template<typename T> struct Superclass { protected: int b; void g() {} }; template<typename T> struct Subclass : public Superclass<T> { void f() { g(); // compiler error: uncategorized b = 3; // compiler error: unr...

Resizing a QGraphicsItem to take up all space in a QGraphicsView, problems when window is resized

Hi, I have a QGraphicsItem (actually, a QDeclarativeItem) and I want it to take up the entire visible space of the QGraphicsView (again, its actually the derived QDeclarativeView class) to which it was added. Normally, you can use QDeclarativeView::setResizeMode(QDeclarativeView::SizeRootObjectToView) and QDeclarativeView will automatic...

Wrapping a C library in a C++ class with type conversion

Hello everyone, I'm slowly learning to be a better C++ programmer and I'm currently debating the best way to implement a wrapper for a C library. The library is a wrapper around a compressed file format that can store tags of various types (char *, char, double, float, int32_t). The types are stored as uint8_t* and there are a bunch o...

Most efficient way to modify a stream of data

I have a stream of 16 bit values, and I need to adjust the 4 least significant bits of each sample. The new values are different for each short, but repeat every X shorts - essentially tagging each short with an ID. Are there any bit twiddling tricks to do this faster than just a for-loop? More details I'm converting a file from one f...

Variables not equivalent fstream vs. declaration

Basically I'm reading the contents of a file using fstream then converting it to const char* type. I'm supplying this to Lua, and Lua will do something with this. This however does not work. What does work is if I do: const char* data = "print('Hello world')"; luaL_pushstring(L, data); luaL_setglobal(L, "z"); They both are in the t...

ReadFile Win32 API

i want to read a file.. but.. when i debug my program it runs but a pop up appears and says system programming has stopped working and in the console, it`s written that Press enter to close the program. my code is :: // System Programming.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "iostre...

Objective C ViewController with a C++ object as a property has getters and setters that re-initialise it every time it's referenced

I have tried so many combination's of code I don't have a sample to show. I have a Objective C view controller, and in the interface I declare a C++ class that contains the preferences of what the user wants to have. I do my @property command in the header and @synthesize command at the top of the .mm file. Then I use the class in the...