c++

Problem in passing arrays from C# to C++

Hi, I have an application in which I need to pass an array from C# to a C++ DLL. What is the best method to do it? I did some search on Internet and figured out that I need to pass the arrays from C# using ref. The code for the same: status = IterateCL(ref input, ref output); The input and output arrays are of length 20. and the corr...

Read from cin or a file

When I try to compile the code istream in; if (argc==1) in=cin; else { ifstream ifn(argv[1]); in=ifn; } gcc fails, complaining that operator= is private. Is there any way to set an istream to different values based on a condition? ...

Setting Tab Order for QTableView in Qt 4.4

Hi, I am having a QTableView that has data loaded with a QStandardItemModel in the form Parameter Value X1 0.456 X2 0.123 .... and so on. Now i have to set the Tab Order property in such a way that i can traverse only through the values and not the parameters. i.e when the control is on 0.456 and if i press '...

Design approach, string table data, variables, stl memory usage

I have an old structure class like this: typedef vector<vector<string>> VARTYPE_T; which works as a single variable. This variable can hold from one value over a list to data like a table. Most values are long,double, string or double [3] for coordinates (x,y,z). I just convert them as needed. The variables are managed in a map like this...

Disable keyboard keys when the console of c Run using c or c++

I want to disable keyboard when my program Run, means that no one can use alt+F4 etc. How I can make it possible using c in window OS. ...

Qt Program deploy to multi platform, how?

Hi, Am new in Qt Programming and i would like to develop a program which i want to run in Windows, Linux(ubuntu), and Mac. I heard that Qt support mutli-platform application development, but my Question is that, would any Qt library need to run these appilication in Ubuntu after i depolyed or compiled. Or ...

Find unique vertices from a 'triangle-soup'

I am building a CAD-file converter on top of two libraries (Opencascade and DWF Toolkit). However, my question is plattform agnostic: Given: I have generated a mesh as a list of triangular faces form a model constructed through my application. Each Triangle is defined through three vertexes, which consist of three floats (x, y & z co...

Can't build wxWidgets on Mac OSX. Need help, please.

I've been trying everything but something or other always stops me cold. Now, I'm trying 2.8.10 (can't make 2.8.7 work) and I keep getting this linker error. Configure shows --with-opengl = no, yet it wants it but can't find it? Why? 10.5 on Macbook Pro wxwidgets: "_glFinish", referenced from: _grabViaOpenGL in libwx_macd_core-2.8....

poco Lib dosnt compile in vs express 9

Hello all im trying to compile the poco lib in vs express 2008 but im keep getting this error : poco-1.3.6p2\foundation\src\eventlogchannel.cpp(40) : fatal error C1083: Cannot open include file: 'pocomsg.h': No such file or directory no i have the mc.exe in my sdk and all the paths in the IDE are seams to be right and nada . does any ...

is i like to have free cross platform network/thread/xml static lib

what the best c++ libs that are simple to use and have no problems to compile in the windows express vs 2008 compilers ? is it best to use different libs for each purpose or to use one generic lib ? ...

pthreads: reader/writer locks, upgrading read lock to write lock

I'm using read/write locks on Linux and I've found that trying to upgrade a read locked object to a write lock deadlocks. i.e. // acquire the read lock in thread 1. pthread_rwlock_rdlock( &lock ); // make a decision to upgrade the lock in threads 1. pthread_rwlock_wrlock( &lock ); // this deadlocks as already hold read lock. I've re...

File and Folder structure of a App/Project based in C.

Hi, What would be the general structure of a App/Project based in C Programming language. libs, includes, header files. etc etc. What would be the class structure. (in OOps) need to be scalable and other features. Something like main.cpp main.h does any one have any good links or images or pdf? ...

Lookin' for a container and memory pool solution...

In an embedded program I have a screen object that needs to manage a list of items to display. The initial list of items will be pulled from a simple DB on screen load and the list will be updated via "Add" and "Remove" events. This list needs to be sorted according to certain criteria. I am looking of a container class that can help me ...

Avoiding improper std::string initialization with NULL const char* using g++

A there any g++ options which can detect improper initialization of std::string with NULL const char*? I was in the process of turning some int fields into std::string ones, i.e: struct Foo { int id; Foo() : id(0) {} }; ...turned into: struct Foo { std::string id; Foo() : id(0) {} //oooops! }; I completely overlooked...

Is delete p where p is a pointer to array always a memory leak ?

following a discussion in a software meeting I've set out to find out if deleting a dynamically allocated, primitives array with plain delete will cause a memory leak. I have written this tiny program and compiled it with visual studio 2008 running on windows XP: #include "stdafx.h" #include "Windows.h" const unsigned long BLOCK_SI...

C++ character to int

Hi, what happens when you cin>> letter to int variable? I tried simple code to add 2 int numbers, first read them, than add them. But when I enter letter, it just fails and prints tons of numbers to screen. But what causes this error? I mean, I expected it to load and use ASCII code of that letter. ...

IShockwaveFlashEvents: how to handle getURL("javascript: ?

Hi, I wrote a simple WinAPI application in C++ which embeds the Abode Flash ActiveX control. It works fine. Next task that i have to do it is handle getURL("javascript:somefoo(someparam)", "")in C++ I don't understand the right way to do this. I create connection point to listen to _IShockwaveFlashEvents and my STDMETHODIMP Invoke(...)...

Cannot convert const char * to char *

Hello, Visual Studio c++ 2005 I am getting an error on the last line of this code. int Utils::GetLengthDiff ( const char * input, int & num_subst ) { int num_wide = 0, diff = 0 ; const char * start_ptr = input ; num_subst = 0 ; while ( ( start_ptr = strstr ( start_ptr, enc_start ) ) != NULL ) { char ...

Doxygen, too heavy to maintain ?

I am currently starting using doxygen to document my source code. I have notice that the syntax is very heavy, every time I modify the source code, I also need to change the comment and I really have the impression to pass too much time modifying the comment for every change I make in the source code. Do you have some tips to document m...

What does "-Wall" in "g++ -Wall test.cpp -o test" do?

-o changes the output filename (I found that using --help) But I can't find out what -Wall does? ...