I'm a newbie at using the STL Algorithms and am currently stuck on a syntax error. My overall goal of this is to filter the source list like you would using Linq in c#. There may be other ways to do this in C++, but I need to understand how to use algorithms.
My user-defined function object to use as my function adapter is
struct is...
How do I use Carbon or CoreFoundation (preferably the latter) to list the contents of a directory?
...
Where can I see printf output in an mfc application during debugging?
Is there a "console" window I can view in the debugger?
(Visual Studio C++ 6.0)
Thanks.
...
Is there a windows api to detect whether or not my dll is running in a system service or a normal user process?
Previously I was looking at the current username and ignoring "SYSTEM", "LOCAL SERVICE" and "NETWORK SERVICE". But now I am seeing GetUsername return machine_name$ in cases where svchost gets run in certain situations befor...
I'm writing an unmanaged Win32 C++ function that gets a handle to a bitmap, and I need to draw on it.
My problem is that to draw I need to get a device context, but when I do GetDC (NULL), it gives me a device context for the WINDOW! The parameter for GetDC () is a window handle (HWND), but I don't have a window; just a bitmap handle.
...
hello.
My problem is, I have block matrix updated by multiple threads.
Multiple threads may be updating disjoint block at a time but in general there may be race conditions. right now matrix is locked using single lock.
The question is, is it possible (and if it is, how?)
to implement an efficient array of locks, so that only portions...
Possible Duplicate:
( POD )freeing memory : is delete[] equal to delete ?
char* pChar = new char[10];
delete pChar; // this should not work but it has same effect as
// delete[], WHY?
// I know this is illegal, but why does it work?
...
I've got this function:
template<typename T>
void Inventory::insertItem(std::vector<T>& v, const T& x)
{
std::vector<T>::iterator it; // doesn't compile
for(it=v.begin(); it<v.end(); ++it)
{
if(x <= *it) // if the insertee is alphabetically less than this index
{
...
If I have something like this:
MyStruct clip;
clip = {16, 16, 16, 16};
I get the following warning from the compiler:
warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
If I active -std=c++0x in the compiler, it does not give any warning. But I'm not sure if I am following the standard. So should I de...
Possible Duplicate:
Take the address of a one-past-the-end array element via subscript: legal by the C++ Standard or not?
int array[10];
int* a = array + 10; // well-defined
int* b = &array[10]; // not sure...
Is the last line valid or not?
...
I'm trying to configure my cross compiler (mipseb-linux-g++) to generate binaries with the MIPSI ISA. There is a flag for this "-mips1". I have this flag in my make file and for some reason g++ is still generating MIPSII instructions (which I assume is default?). Am I doing anything wrong? Here's my process flow:
write c++ program
...
Hi,
Currently I'm building an application that is an image filter that should run in real-time. It's filter that transforms image captured from the camera and displays a transformed image just like the camera preview does.
The problem that I'm having with this is that, the performance is critical to this app, as every captured pixel sh...
Terrible title, sorry. I used cmake to generate a makefile and I specified g++ as the C++ compiler and when I run the generated makefile using make or gmake I get all these compile errors and all my symbols have trailing â's on them. Any thoughts on what might be behind these mysterious â's?
...
In my C++ solution there are two projects : a SDI app and a MDI app.
Both have quite a lot of menus, and I often make changes (add / delete / replace menus).
Instead of checking for correctness myself (I'm error-prone, you know), I would love to have an automation for this.
Ideally it would warn me for either not having a handler for s...
Basically, I'm passing a pointer to a character string into my constructor, which in turn initializes its base constructor when passing the string value in. For some reason strlen() is not working, so it does not go into the right if statement. I have checked to make sure that there is a value in the variable and there is.
Here is m...
sys info : win xp SP3 , Microsoft Visual Studio 2008
Version 9.0.21022.8 RTM
Microsoft .NET Framework
Version 3.5 SP1
Qt Add-in 1.1.5
I installed Qt 4.6.3 from the site http://qt.nokia.com/downloads/windows-cpp-vs2008.
Then I added the Add-in Qt 1.1.5 and configured the PATH variable.
When I open a new QT project , default example wo...
For example:
if (value == array[size]) //if the value (unique) is present in an array then do something
can this be done in one statement without having to call a function or a basic for loop statement?
...
Hi, I have this function:
char* ReadBlock(fstream& stream, int size)
{
char* memblock;
memblock = new char[size];
stream.read(memblock, size);
return(memblock);
}
The function is called every time I have to read bytes from a file. I think it allocates new memory every time I use it but how can I free the memory once I ...
I'm trying to add functionality to the v8sharp project and I'm having some issues (I'm not very good at C++ so I'm pretty sure the issue lies in my lack of C++ abilities rather than misusing v8.)
Anyone in v8sharp we have this code
v8value.cpp:
v8sharp::V8FunctionWrapper^ V8ValueWrapper::WrapFunction(v8::Handle<v8::Value> value) {
...
Hi
In my application, I allow users to write plugins using JavaScript. I embed V8 for that purpose. The problem is that developers can't use things like HTTP, Sockets, Streams, Timers, Threading, Crypotography, Unit tests, et cetra.
I searched Stack Overflow and I found node.js. The problem with it is that you can actually create HTTP...