c++

Is it possible to exit a for before time in C++, if an ending condition is reached?

Hello, I want to know if it is possible to end a for loop in C++ when an ending condition (different from the reacheing right number of iterations) is verified. For instance: for (int i = 0; i < maxi; ++i) for (int j = 0; j < maxj; ++j) // But if i == 4 < maxi AND j == 3 < maxj, // then jump out of the two nested lo...

Difference between WinMain,main and DllMain in C++

What is the difference between the three functions and when to use them?? ...

Empty _ASSERTE Dialog Box from ISAPI Extension

I have an ISAPI extension DLL written in C++ using Microsoft Visual Studio 2003 running in IIS 5.1 on XP Pro. Whenever an _ASSERTE fires I just get a an empty message box with 'Error' in the title bar and Abort/Retry/Ignore buttons. What I don't see is any of the expression text from the _ASSERTE macro. I've traced into the runtime libra...

C++ ATL Member Variable access help

I am not familiar with this, and can use a kick start. I am using ATL (unmanaged C++) user control and would like to use the ShockWave ActiveX object. I need to know how to declare it so that I can set a property or call a method. For instance, if I could assign a variable to it, then I would like to call 'variable->LoadMovie()' I kno...

What is the definitive link for C programming language?

Lately all modern programming languages have a definitive web site to support, distribute, learn the programming language, as well as community forums, e-mail lists and so on. Java has java.sun.com, python has python.org, etc. However C/C++ does not seem to have such a site. Which site do you use, say in a document, to link for C or C+...

Need to 'wrap up' a C++ dll/h/lib/xml/exe based SDK into a COM to use in a C# 2.0 project

I just got handed an SDK made of C++ dll, lib, exe, and various .h files. I presume it is meant for C++ developers. The sample projects they provide with their documentation are all written in C++. I am able to spin them up with Visual Studio 8 (2005) and run them. They do control the device as advertised. However the project this nee...

Easy UNICODE in C++

Is there a way to make all character sequences UNICODE by default? For instance, now I have to say: std::wstring wstr(L"rofl"); instead, I'd like to say std::wstring wstr("rofl"); Thanks! Visual C++ 8.0 ...

Managing C++ objects in a buffer, considering the alignment and memory layout assumptions

I am storing objects in a buffer. Now I know that I cannot make assumptions about the memory layout of the object. If I know the overall size of the object, is it acceptible to create a pointer to this memory and call functions on it? e.g. say I have the following class: [int,int,int,int,char,padding*3bytes,unsigned short int*] 1) ...

Pointers, smart pointers or shared pointers?

I'm programming C++ with normal pointers, but I have heard about libraries like Boost that implement smart pointers and I have seen that in Ogre3D rendering engine there is a deep use of shared pointers. What's exactly the difference between the three, and should I stick on using just a type of them? Thanks. ...

Python: C++-like stream input

Hi! Is there a pythonic way of reading - say - mixed integer and char input without reading the whole input at once and without worrying about linebreaks? For example I have a file with whitespace-separated data of which I only know that there are x integers, then y chars and then z more integers. I don't want to assume anything about l...

OS X equivalent to OutputDebugString() ?

I'm examining the feasibility of porting an existing Windows MFC control to OS X/Carbon. My test bed is a C++ Carbon application generated using the XCode 3 Wizard. I'm looking for a quick way to dump some trace info to the debugger or the OS X equivalent of DbgView. On Win32 I'd use OutputDebugString() - what's the deal on OS X? Is th...

Help to correct source code, with template.

I tried to compile the example posted (http://stackoverflow.com/questions/412165/c-service-providers) and failed to VS8 VC9. I have little experience with template. Any suggestions? Tanks. These are the errors : dictionarystl.cpp(40) : error C2663: 'std::_Tree<_Traits>::find' : 2 overloads have no legal conversion for 'this' pointer dic...

How popular is C++ for making websites/web applications?

I don't know why this is question is bugging me, but time after time I come back to the though - why not make websites in C++? So far I know of none (except a rumor about Yahoo). Most use PHP, Java or ASP.NET. Some are built on Ruby or Python, but even those are minorities. At the same time, looking at StackOverflow, it seems that C++ i...

InternalsVisibleTo not working for Managed C++

InternalsVisibleTo is not working for my managed C++ projects, but it is for my C# projects. Any help would be appreciated. Here is a simplified layout. Project A - C#, has an internal property I want to access from B/C. Project B - Managed C++. References A. Project C - C#, references A. All projects are signed with the same key. Lo...

How do I source/link external functions in C or C++?

EDIT: I suppose I should clarify, in case it matters. I am on a AIX Unix box, so I am using VAC compilers - no gnu compilers. End edit I am pretty rusty in C/C++, so forgive me if this is a simple question. I would like to take common functions out of a few of my C programs and put them in shared libraries or shared objects. If I w...

CPU Utilization of Service DLL?

I need to find out the CPU utilization of a service DLL. I have looked in existing samples and we can find CPU utilization for processes. I think DLL will be loaded by services.exe. So is it possible to find out CPU utilization by DLL. I am working in C++ on the Windows platform. ...

Compiler error for modifying a non-const object

#include "iostream" #include "vector" class ABC { private: bool m_b; public: ABC() : m_b(false) {} ABC& setBool(bool b) { m_b = b; return *this; } bool getBool() const { return m_b; } }; void foo(const std::vector<ABC> &vec) { vec[0].setBool(true); } ...

A random number generator that can get different numbers in < a second

I'm in need of a C++ (pseudo, i don't care) random number generator that can get me different numbers every time I call the function. This could be simply the way I seed it, maybe there's a better method, but every random generator I've got doesn't generate a new number every time it's called. I've got a need to get several random number...

Issues when dllimport is not used by a client of an exported class?

Apart from method calls not being optimized, are there any other issues? A difference I have noticed is that default compiler generated methods (e.g. operator=) in the class appear either in the exporting dll (if dllimport is used by the client) or in the client binary (if dllimport is not used). In this latter case, it's almost as if ...

Array over written with last value assigned?

I have a pointer to pointer array. I am assigning each row in the while loop below and the printf inside the while loop shows each is assigned my id number 1-20. After, out side of the while loop I iterate through the array and every element is written with id 20? Any help is greatly appreciated. (FYI- I am using the Template2doc library...