c++

Socket writing problem with TCP/IP

I am using TCP/IP socket example i.e. "echoclient", and I am facing problems with writing and reading. I am connecting to server socket but it shows null data. I don't know whether it is data conversion problem or any other issue. ...

Is there a way to detect an alphanumeric Unicode symbol?

I have a Unicode string consisting of letters, digits and punctuation marks. Ho can I detect characters that are digits and letters (not necessarily ASCII) with a C++ standard library or Win32 API? ...

C++ empty String constructor

I am a C++ beginner, so sorry if the question is too basic. I have tried to collect the string constrcturs and try all them out (to remember them). string strA(); // string(); empty string // incorrect string strB("Hello"); // string( const char* str) string strC("Hello",3); // string( const char* str, size_type length) stri...

Is it less expensive to dc->DrawLine() a bunch of times or one blit?

I have a control that has a grid. Is it more expensive to draw the horizontal and vertical lines that make up the grid each time using the draw line function in the device context class or would it be faster to draw the grid once to a memory device context and then blit it each time to the window dc? Thanks. ...

Helper library for distributed algorithms programming?

When you code a distributed algorithm, do you use any library to model abstract things like processor, register, message, link, etc.? Is there any library that does that? I'm thinking about e.g. self-stabilizing algorithms, like self-stabilizing minimum spanning-tree algorithms. ...

Replace strings in native .exe using c#

hi, how can I catch all strings from a native windows .exe file and replace them later with others using c# ? Background: I want to create a c# tool to extract and replace strings from a simple .exe file. Is this possible somehow? ...

How to hide strings in a exe or a dll?

I discovered that it is possible to extract the hard-coded strings from a binary. For example the properties view of Process Explorer displays all the string with more than 3 characters. Here is the code of a simple executable that I wrote to simply test it: #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0501 #endif #include <stdio.h> #in...

Difference between two DLL declarations

Hi Everyone, I have a simple but subtle question. Below you see two different declaration variants of the same class from a DLL header file. Can anybody tell me the difference of this class declaration; class __declspec(dllexport) Car { public: Car(); void drive(void); typedef enum { None, Indented } Formatting; } from ...

Where to install SDK DLLs on a system so that they can be found by apps that need them.

I've got an SDK I'm working on and the previous developer just dropped the DLLs in System32 (Apparently a serious offense: see here) So assuming I move them out into \Program Files\\SDK (or whatever), how do I make sure that all the apps that needs those DLLs can access them? And to clarify, all apps that access these are doing early (...

Objective-C vs C++

At the risk of this turning info flame bait, my curiosity has gotten the better of me yet again and I have to ask what I feel to be a very compelling question. Is there any hard data comparing Objective-C to C++, specifically on the iPhone but maybe just on the Mac desktop, for performance of various similar language aspects? I am very...

Why should I prefer to use member initialization list?

I'm partial to using member initialization lists with my constructors... but I've long since forgotten the reasons behind this... Do you use member initialization lists in your constructors? If so, why? If not, why not? ...

32 bit application failed to run on x64 Win2003 due to

Here is my problem: I have developed an application which can be run on various platforms, including windows and unix. This app runs well on pure Win32 box (WinXP) or a pure Win64 (Win2K3 x64 edition) and other unix platforms. It only fails when running on a 64 bit Win2K3 in 32 bit mode. This app invokes a third party dll at the runti...

How do text differencing applications work?

How do applications like DiffMerge detect differences in text files, and how do they determine when a line is new, and not just on a different line than the file being checked against? Is this something that is fairly easy to implement? Are there already libraries to do this? ...

Is there a way to determine if a top level Qt window has been moved?

I am trying to determine when the main window of my application has been moved. The main window is a standard QMainWindow and we've installed an eventFilter on the QApplication to look for moveEvents for the QMainWindow, but none are being triggered. For a variety of reasons, subclassing the QMainWindow isn't really an option. Any thoug...

Building C++ source code as a library - where to start?

Over the months I've written some nice generic enough functionality that I want to build as a library and link dynamically against rather than importing 50-odd header/source files. The project is maintained in Xcode and Dev-C++ (I do understand that I might have to go command line to do what I want) and have to link against OpenGL and S...

Compiling C++ Program Causes "Fatal Error LNK1104"

Hey folks, I am trying to compile a c++ application using the following command in command prompt: cl -I"c:\Program files\Java\jdk1.5.0_07\include" -I"c:\program files\java\jdk1.5.0_07\include\win32" -MD -LD HelloWorld.cpp -FeHelloWorld.dll However this produces the following error: LINK : fatal error LNK1104: cannot open file 'MSVCR...

Is there a heap class in C++ that supports changing the priority of elements other than the head?

I have a priority queue of events, but sometimes the event priorities change, so I'd like to maintain iterators from the event requesters into the heap. If the priority changes, I'd like the heap to be adjusted in log(n) time. I will always have exactly one iterator pointing to each element in the heap. ...

Weird way to write "hello world"

Possible Duplicates: Changing c++ output without changing the main() function How to assign a method's output to a textbox value without code behind How to write hello world without modifying main function? Thanks int main(){return 0;} ...

Deleting a heap then dereferencing a pointer to that memory

This is code from an exercise: #include <iostream> using namespace std; int main() { int n = 13; int* ip = new int(n + 3); int* ip2 = ip; cout << *ip << endl; delete ip; cout << *ip2 << endl; cout << ip << tab << ip2 << endl; } When the space allocated to the int on the heap is deleted, I thought that dere...

How to: change source directory within a VS2005 Add-In?

So, I'm writing a C# Add-In that generates C++ source files by weaving aspects into them using AspectC++. Now, I'd like to take those generated files and send them to the compiler instead of the original source... How would I do this within the Add-In? I've tried looking at the VCCLCompilerTool, VCCodeModel, and similar interfaces for...