c++

Fork or copy a users browser session in IE

Is it possible to fork a users session (or do something similar) in a Internet Explorer plugin? I want to process the page the user is on when they click a button in the toolbar. To avoid interrupting the users browsing, I'd like to "copy" everything so I can parse and process the page in the background. The processing can involve thing...

Suppressing C++ 'Post-Build Event' when using msbuild

I am using msbuild to build a C++ project and I want to suppress the 'Post-Build Event'. I have tried the following properties with no success: /property:PostBuildEvent= /property:VCPostBuildEventTool= Neither will make any difference and the post build events are still executed. Does anyone know how to suppress these (and potential...

Compile 32 bit VS 2003 project to 64 bit

I currently have a 32 bit dll that was created with Visual Studio 2003 in C++ using Managed Extensions. I'm now trying to compile a 64 bit version without having to upgrade to C++/CLI. I've been following the tutorial at this location. I'm getting the following error: fatal error C1197: cannot reference 'c:\windows\microsoft.net...

C# equivalent of std::sort and std::unique

I have a list of integers in C#. I wish to remove duplicates. In C++ I would run it through the std::sort and then std::unique algorithms for a very efficient way of obtaining the unique list. What's the best way to do the same thing in C#? In other words, I'm looking for a more elegant way to do the following code: private static...

How can I negate a functor in C++ (STL)?

I have some function to find a value: struct FindPredicate { FindPredicate(const SomeType& t) : _t(t) { } bool operator()(SomeType& t) { return t == _t; } private: const SomeType& _t; }; bool ContainsValue(std::vector<SomeType>& v, SomeType& valueToFind) { return find_if(v.begin(), v.end(), FindPredicate...

How to avoid scientific notation for large numbers?

I am doing 2^1000 and am getting this: 1.07151e+301 Is there any way to actually turn this into a proper number without the e+301 or at least can anyone show me where I can see how to turn this in to a real number, by some way working with the e+301 part Thanks ...

Fastest way to create large file in c++ ?

Create a flat text file in c++ say 50 - 100 MB say the content like 'Added first line' should be inserted in to the file for 40 lakhs time ...

Creating a lib from other libs : is it possible ?

I'm using Windows CE Platform Builder and my code is written in C++ . For each of the folders in the project I'm creating a lib ( the code is statically linked ) . However , there are about 20 libs so far . Is there a way to reduce their number ? I was thinking of creating a lib from other libs , but I don't know if that's even possible ...

Paths and CreateProcess

Hello Folks, I have a question regarding a symptom of my misuse of CreateProcess. I'm using the lpcommandline parameter to feed the path to my executable and parameters. My misuse is that I have not surrounded the path to the exe with quotes. My question is, why does the CreateProcess work just fine on most computers and not others?...

Simple example of threading in C++

Can someone post a simple example of starting two (Object Oriented) threads in C++. I'm looking for actual C++ thread objects that I can extend run methods on (or something similar) as opposed to calling a C-style thread library. Thanks. Update - I left out any OS specific requests in the hopes that whoever replied would reply with c...

Simple hashmap implementation in C++

I'm relatively new to C++. In Java, it's easy for me to instantiate and use a hashmap. I'd like to know how to do it in a simple way in C++, since I saw many different implementations and none of them looked simple to me. ...

How do I cast a bool to a BOOL ?

Am I safe in casting a C++ bool to a Windows API BOOL via this construct bool mybool = true; BOOL apiboolean = mybool ? TRUE : FALSE; I'd assume this is a yes because I don't see any obvious problems but I wanted to take a moment to ask only because this may be more subtle than it appears. Thanks to Dima for (gently) pointing out my...

Embed non-managed directX into C# form

I got a quick question about running a directX application (C++) in a managed environment. I'm attempting to write a MDI tool (in C#) where the background of the parent window would be an embedded render window of directX (C++). I've read ways that involved writing the C++ into a native dll, however it would be prefered to be able to h...

macro definition containing #include directive

Hi folks, Is there a way to define a macro that may contain #include directive in its body. If I just put the "#include", it gives error C2162: "expected macro formal parameter" since here I am not using # to concatenate strings. If I use "# include", then I receive the following two errors: error C2017: illegal escape sequence err...

Drawbacks to templates and the STL in C++

Are there any drawbacks to using the STL or templates. Are there any situations for which they are inappropriate. ...

infinite loop in c++

I'm learning C++ and writing little programs as I go along. The following is one such program: // This program is intended to take any integer and convert to the // corresponding signed char. #include <iostream> int main() { signed char sch = 0; int n = 0; while(true){ std::cin >> n; sch = n; std::cout << n << " -->...

pass DataTable to unmanaged environment (visual c# 2005)

Hi, What will the best way to pass a datatable data to unmanaged environments? (c++) Ofer ...

Why are C++ methods sometimes defined inside classes?

I frequently run into large, non-template classes in C++ where simple methods are defined directly in the class body in the header file instead of separately in the implementation file. For example: class Foo { int getBar() const { return bar; } ... }; Why do this? It seems like there are disadvantages. The implementation is not a...

Why is a char and a bool the same size in c++?

I'm reading The C++ Programming Language. In it Stroustrup states that sizeOf(chr) is always 1 and 1 <= sizeOf(bln). The specifics depend on the implementation. Why would such a simple value as a boolean take the same space as a char? ...

Efficient data transfer from Java to C++ on windows

I'm looking to stream lots of data (up to ~1 Gbit) from Java to a C++ application (both on the same machine). I'm currently using a FIFO on Linux but need a Windows solution too. The most cross-platform method seems to be a local socket, but: a) won't I get huge overhead from TCP checksumming and copying to & from kernel space, and b) w...