c++

How to retrieve foreign host's MAC address in C++

Currently we're parsing arp request output from the command line. string cmd = "arp -n "; cmd.append(ipaddress); cmd.append(" | grep "); cmd.append(ipaddress); fgets( line, 130, fp); fgets( line, 130, fp); ret.append(line); ... It works, but is there a way to do this using a library function that wont depend so much on the native com...

Playing YouTube videos in a Windows Mobile application

I am working on an application for Windows Mobile 6 (or maybe 5) that plays YouTube videos. Well, it should play YouTube videos (and control/query the player about status changes, current frame/time, etc.) After scouring the web for quite some time now (and a few trials), I still couldn't find a way to do this. The options I know of are...

system wide api hook

What is the best way to do system wide user mode (NOT KERNEL MODE) api hook on Windows NT? ...

How to send email in C++?

Duplicate: c++ smtp example any suggestion libraries? ...

Modern C++ Game Programming Examples

To what extent are modern C++ features like: polymorphism, STL, exception safety/handling, templates with policy-based class design, smart pointers new/delete, placement new/delete used in game studios? I would be interested to know the names of libraries and the C++ features they use. For example, Orge3D uses all modern C++ feat...

How to create a stub on the exchange server?

I am developing a E-mail archive project using stubbing concept, In that I need to create a stub on the exchange server, if you have sample code, please share it. ...

How to convert const char* to char*

Hi can any body tell me how to conver const char* to char*? get_error_from_header(void *ptr, size_t size, size_t nmemb, void *data) { ErrorMsg *error = (ErrorMsg *)data; char* err = strstr((const char *)ptr,"550"); //error cannot convert const char** to char* if(NULL != err) { strncpy(error->data,(char*)ptr,LENGTH_...

Operator overloading >>

Hey, I'm very new to C++ operator overloading and having some teething trouble. I've defined: 'void Graph::operator>>(const char* param)' to accept a string and then input then perform certain actions on the object. How do I call this function that I've defined (>>) ? In what ways can I use it? ...

Common C++ framework

Has anyone experienced with Common C++ Framework? Can it be used as a framework for a Telecom networking application? ...

Controlling Lua5.1's garbage collector

OK so I have a C++ class that is exposed to Lua using SWIG. The script creates the object but a manager class also has a pointer to the object so it can be modified in C++(or another script) for whatever reason. The problem is that when the script finishes the object is freed, how can I control what the Garbage collector collects withou...

std::map unable to handle polymorphism?

When using std::map in c++, is it possible to store inherited classes as their "base class" in the map and still being able to call their overloaded methods? See this example: #include <iostream> #include <map> class Base { public: virtual void Foo() { std::cout << "1"; } }; class Child : public Base { public: void Foo(...

how do I use STL algorithms with a vector of pointers

I have a vector of pointers that are not owned by the container. How do I use algorithms on the targets of the pointers. I tried to use boost's ptr_vector, but it tries to delete the pointers when it goes out of scope. Here is some code that needs to work: vector<int*> myValues; // ... myValues is populated bool consistent = count(my...

Is there an equivalent to WinAPI's MAX_PATH under linux/unix?

If I want to allocate a char array (in C) that is guaranteed to be large enough to hold any valid absolute path+filename, how big does it need to be. On Win32, there is the MAX_PATH define. What is the equivalent for Unix/linux? ...

Calculate time between 2 TDateTime, with a twist

I need to find out how to get the time between 2 times, but only if it is within work hours(Stored in a database) This is what I got for now, but it is totally wrong. the total won't bee correct. int __fastcall Organisasjon::CalculateResponsetimeInOpeninghours(std::auto_ptr<DBCommand> cmd, long orgid, TDateTime starttimeIn, TDateTime e...

Should managed code return an error or throw exceptions to unmanaged code?

Hi I am about to expose a service written in C# to a legacy C++ application using COM. What is the best approach to report errors to the unmanaged client? Throwing exceptions or simply return an error value? Thanks, Stefano ...

Problem in incrementing

I have a variable declared like this: int j=0; When I write: cout<<j++<<" "<<j++<<" "<<j++<<"\n"; I receive this output: 2 1 0 I expect to receive this output: 0 1 2 Could you explain the result? ...

Conversion Problem from VS2003 to VS2005?

Hi I am trying to convert a project from vs2003 to vs2005.after conversion completed some include headerfile.h statement missing and generates include "serialize" .how to fix this.even i copy and paste.it prompts for the source would be modified outside the environment msg appears. what can i do to fix this any idea??? Thanks in advance...

Nested function calls order of evaluation

It's well-known that the order of evaluation of a function's arguments in unspecified and can differ between different compilers. What doesn't seem so clear is whether function calls can be interleaved, in the following sense: f(g(h()), i(j())) Let's assume the compiler chooses to evaluate f's first parameter first. Is the compiler f...

c++ accidental static

I've got a linked list class and for some reason when I increment an int in one object e.g linked1.size for some reason linked2.size also increments! And ideas why this is? I didn't intentionally make it a static variable. my code: main() { Vlist v1; v1.add(1,0); v1.add(2,0); Vlist v2; } Incrementing the size member vari...

wtf is WTF? (in WebKit code base)

I downloaded Chromium's code base and ran across the WTF namespace. namespace WTF { /* * C++'s idea of a reinterpret_cast lacks sufficient cojones. */ template<typename TO, typename FROM> TO bitwise_cast(FROM in) { COMPILE_ASSERT(sizeof(TO) == sizeof(FROM), WTF_wtf_reinterpret_cast_sizeof_types_is_equal...