c++

Can linking with the same library twice be a problem with g++?

I noticed that when I make my application with gcc and look at the output during the linking phase, I see the following lib included twice: /home/rb01/opt/trx-HEAD/gcc/4.2.4/lib/../lib64/libstdc++.so And so I was just wondering if this is a problem with g++ (gcc) or if the second one is simply ignored? Thanks! ...

Mouse manipulation inside Virtual PC

Hi. I develop an application, which automates some simple tasks inside Virtual PC. Now I faced with problem: I can't figure out how I can manipulate mouse inside VPC. I do something like this: HWND hDW = (HWND)0x000B03E0; // handle to virtual machine screen int x = 70; int y = 130; SendMessage(hDW, WM_LBUTTONDOWN, MK_LBUTTON, MAKE...

C++: Getting incorrect file size

I'm using Linux and C++. I have a binary file with a size of 210732 bytes, but the size reported with seekg/tellg is 210728. I get the following information from ls-la, i.e., 210732 bytes: -rw-rw-r-- 1 pjs pjs 210732 Feb 17 10:25 output.osr And with the following code snippet, I get 210728: std::ifstream handle; handle.open("outp...

What code should be written to accept Lower and Upper case choices ?

Hi all , I'm beginner to c++ and writing a program that accepts user choices and acts according to it...my only problem is when the user enters Uppercase choice...the program treats it as it's a wrong choice...like if 'e' was a choice for entering a number..if the user entered 'E' the program won't display the "enter the number" message....

C++ : what is :: for?

If you go to the accepted answer of this post Could someone please elaborate on why he uses: double temp = ::atof(num.c_str()); and not simply double temp = atof(num.c_str()); Also, is it considered a good practice to use that syntax when you use "pure" global functions? ...

The Design and Evolution of C

Hi guys, Is there a book that describes the design and evolution of C similiar to the book 'The Design and Evolution of C++' by Bjarne Stroustrup ? thanks, Prakash ...

DirectX9, DirectDraw, Optimization?

First off, I'm programming a game. Currently in the render function there are two calls to two different functions. One renders some text, one renders sprites. On my computer (AMD Phenom(tm) II X4 955 Processor (4 CPUs), ~3.2GHz, 4096MB RAM DDR2, NVIDIA GeForce GTX 285) I have a render speed of ~2200 FPS when rendering around 200 sprite...

Building RAPI.h in VS 2005, fail on open include file

Hi all, this may sound too simple, but I'm missing something. I need to write a RAPI Windows Console app using C++. I'm currently using VS2005. I've created a brand new empty Windows Consol app "MyTestRAPI" from documentation, I know I need the include of the "RAPI.H" file. So, I've tried as #include <rapi.h> and also by #includ...

Schliemann's method of programming language learning

Background: 19th-century German archeologist Heinrich Schliemann was of course famous for his successful quest to find and excavate the city of Troy (an actual archeological site for the Troy of Homer's Iliad). However, he is just as famous for being an astonishing learner of languages - within the space of two years, he taught himself...

C++ don't know why content is changed

The code is from my friend. Please have a look at it and give us some suggestions. in VoltageForDisplayAndAnalyze.h file private: string * grpVolFileName[ MAX_NUM_OF_GROUP ]; //for voltage files fstream * aStream_grpVolt[ MAX_NUM_OF_GROUP ]; in VoltageForDisplayAndAnalyze.CPP file void VoltageForDisplayAndAnalyze::MakeFileNameF...

WM_MOUSELEAVE not being generated when left mouse button is held

In my Win32 app, I don't get WM_MOUSELEAVE messages when I hold down the left mouse button and quickly move the mouse pointer out of the window. But If I, holding down the left mouse button, start from the inside of the window and move slowly past the window edge, it'll generate a WM_MOUSELEAVE. If I don't hold the left mouse button, I...

Is there a limit to how big an xml file can be for tinyxml to parse it?

I have an xml file that is about 42k in size. Shouldn't tinyxml be able to parse a file of this size. Looking at the tinyxml source code, it appears to just read the entire file in as a char *. When I reduce the xml file in size to 7k, tinyxml works just fine. Is there a definitive limit to the # of bytes that tinyxml will parse? ...

Saving image as JPG -library?

I'd like to find a JPEG-writing library that can be statically linked (so there are no DLL dependencies). No JPEG-reading ability is required. Edit: I got LibGD working, but it had one problem described here: http://stackoverflow.com/questions/2307965/libgd-library-is-not-working-crash-when-saving-image ...

Can a std::string be assigned within a constructor?

I have the following constructor: TCPConnector(int32_t fd, string ip, uint16_t port, vector<uint32_t>& protocolChain, const Variant& customParameters) : IOHandler(fd, IOHT_TCP_CONNECTOR) { _ip = ip; _port = port; _protocolChain = protocolChain; _closeSocket = true; _customParamete...

What header should I include for memcpy & realloc in a C++ iPhone program?

Hello, I am porting a project to the iPhone and it uses realloc and memcpy which are not found. What is the header to include? it's a projet mixing objc and c++ and I am starting to be lost. Thanks in advance for your help! ...

c++ templates in an iPhone project

Hello, I am porting a project to the iPhone system and I am facing the following problem: I have an header containing c++ templates If I rename it to .mm, it does not compile (because it should be an header) and if I keep it as .h, it is interpreted as an objective C header Do you have a workaround to fix this issue? Thanks in advance...

Which is the best data-structure for iterating through arrangements of a string?

Lets say, we have string "ABCAD", now we need to iterate through all possible arrangement of this string in both clockwise and counter-clockwise direction. My ugly implementation looks like this: string s = "ABCAD"; string t =""; for(int i = 0; i < sz(s); i++){ t = s[i]; for(int j = i+1; ; j++){ if((j) == sz(s)){ ...

C++ memory table

Can anyone recommend a lightweight open source C++ table data structure that has data access similar to a database table? (i.e. a 2D array but with named columns - ideally, each column will hold data of a single type [see below]). I have had a quick look on Google, but have not found anything very useful. The way I see it, these are th...

Out of proc function call and HANDLE type returned (Windows C++)

I need to call one function using maximum privileges (NT AUTHORY\System) from other process (IIS7 module work process) running in same local computer in much less privileged mode (NT AUTHORY\Network service). IIS module will call that function passing some text (user name) and that function need to return HADNLE type witch will be close...

Qt installation error

i got an error when am trying to configure Qt. Erro : execute: File or path is not found (nmake) execute: File or path is not found (nmake) Cleaning qmake failed, return code -1 // installion files. InterBase...............no Sources are in..............E:\xampp\Qt\4.6 Build is done in............E:\xampp\Qt\4.6 Ins...