c++

why is this syntax exclusively used to initialize string literals and can't be used for an array of characters?

Possible Duplicate: initializing char arrays in a way similar to initializing string literals below is a sample of initializing a string literal in which a terminating null character is added at the end of string, necessarily: char reshte[]="sample string"; I wonder why can't we initialize an array of characters without ter...

Convert vector<char> buf(256) to LPCSTR?

Is there a way to convert the above? If so what is the best way? I guess you can loop through the vector and assign to a const char*, but I'm not sure if that is the best way. ...

C++ Implementing scripting (Repeatable Actions)

I have a desktop app written in C++. It does a variety of different things and interacts with a database. I have made most actions that need to be performed selectable from a list. Actions are performed serially on data sets and need to be saved and played back at a later time on a different result set. The actions are typically perform...

Oddity with structs defined in files other than main.cpp

Hi everyone, I have found that a struct (with an array of doubles and one integer) defined in a separate Cpp-file, but called from main sends unreasonable values to cout for the array. Below what I hope to be a minimum example, along with the console output. My apologies should my code be scrambled -- I have been struggling a bit with ...

What's the best way to demonstrate the effect of affinity setting?

Once I noticed that Windows doesn't keep computation-intensive threads on a specific core - it keeps switching cores instead. So I speculated that the job would be done faster, if the thread would keep access to the same data caches. And really, I was able to observe a stable ~1% speed improvement after setting the thread's affinity mask...

[C++] Why doesn't delete destroy anything ?

I'm playing a little with memory dynamic allocation, but I don't get a point. When allocating some memory with the new statement, I'm supposed to be able to destroy the memory the pointer points to using delete. But when I try, this delete command doesn't seem to work since the space the pointer is pointing at doesn't seem to have been ...

to monitor local pc network and block ip's is winpcap is the tool ?

Hello i need to build network monitor that sniff the network and to hold ip policy that will enable me to block the network based on this policy for example: if im getting incoming http protocol from ip that is in my ip policy black list and now i like to block it and for example redirect this http request so it could contain now my http...

Perform vector operation

Hi, I'm using the vector container to store an array of doubles. Is there any quick way of multiplying each element in my vector by some scalar without using a loop. For example: vector<double> Array(10,1); will initialise an array of 10 doubles with initial value 1. To multiply this array by 0.5 I would write: for(unsigne...

memmem() STL way?

Is there an STL algorithm which can be used to search a sequence of bytes inside a buffer like memmem() does? ...

ctype and strings and containers

Is there any reason that the ctype facet functions (is,scan_is,scan_not only support plain char pointer, and not iterator based containers, like std::string or even a std::vector... then one could write: const ctype<char>& myctype = use_facet<std::ctype<char> >(locale("")); string foo_str = "hi there here is a number: 748574 and text ag...

How to write a makefile for a C++ project which uses Eigen, the C++ template library for linear algebra?

Hi Guys, I'm making use of Eigen library which promises vectorization of matrix operations. I don't know how to use the files given in Eigen and write a makefile. The source files which make use of Eigen include files as listed below, these are not even header files (They are just some text files)- <Eigen/Core> <Eigen/Dense> <Eigen/Eige...

Special member functions in C++0x

The Wikipedia article about special member functions doesn't contain any reference to move constructors and move assignment operators. I would like to update the entry but I'm not sure what the 0x standard says. What are the rules regarding these two functions? Are they automatically generated by the compiler and if so when? Edit: I...

What does void(U::*)(void) mean?

I was looking at the implementation of the is_class template in Boost, and ran into some syntax I can't easily decipher. template <class U> static ::boost::type_traits::yes_type is_class_tester(void(U::*)(void)); template <class U> static ::boost::type_traits::no_type is_class_tester(...); How do I interpret void(U::*)(void) a...

Source IP from UDP packet in c under window OS

I want to get the source IP of UDP packet kindly guide me so that I can make it possible. I am working in c under windows platform. ...

is it possible to build ATL project in VS express 2010

Hi i know that ATL and MFC are now part of Windows Driver Kit my question is how can i (if it possible .. ) to build project or import ATL project to visual studio express ...

C++ Programming Copy Constructor

Possible Duplicate: Why should the copy constructor accept its parameter by reference in C++? Hi experts, Can you please tell what happens if I din't give reference of an object in copy constructor. Thanks in Advance Crazy ...

Using IMFSourceResolver::CreateObjectFromByteStream

Hi, I am trying to use the IMFSourceResolver::CreateObjectFromByteStream method to create a IMFMediaSource instance for a DRM protected WMA file. I am adapting the ProtectedPlayback sample from the Windows SDK as a playground. The end goal I wish to achieve is to have the playback process fed by a custom implementation if IMFByteStrea...

What's is wrong with this piece of c++ code? I am practising object oriented programming.

#include <iostream> #include <math.h> using namespace std; class Point{ public: Point(int xx, int yy); ~Point(); int getX(); int getY(); void setX(int xx){ x = xx; } void setY(int yy){ y = yy;} private: int x; int y; }; Point::Point(int xx, int yy) { x = xx; y = yy; } Point::~Point() { } in...

question about algorithm complexity

i have tried implement two methods recursive and dynamic method and both took 0 second it means that no one is better in my computer or something is wrong in code? here is these methods 1// recursive #include <stdio.h> #include <time.h> #include <iostream> using std::cout; void print(int n){ if (n<0) return ; cout<<n<<"...

vc++ IE plugin show HTML page as dropdown item

i want to create an IE plugin with a button. when i click the button it has to show a small HTML page as dropdown item. please let me know if you have any answers. ...