And if so, why some Win32 headers use it?
For instance:
BOOL APIENTRY VerQueryValueA( const LPVOID pBlock,
LPSTR lpSubBlock,
LPVOID * lplpBuffer,
PUINT puLen
);
A bit more elaboration: If the API never uses references (or any other C++-only constructs) but only pointers and values, what is the point of having const L...
I need some division algorithm which can handle big integers (128-bit).
I've already asked how to do it via bit shifting operators. However, my current implementation seems to ask for a better approach
Basically, I store numbers as two long long unsigned int's in the format
A * 2 ^ 64 + B with B < 2 ^ 64.
This number is divisible by 2...
I am trying to change a certain text box message. It will display my output.
This is what I have in my main()
#include "form2.h"
....
string recvMSG = "random";
182:: Form2::changeOutput(recvMSG);
...
within my form2.h I have:
#include <string.h>
#include <iostream>
#include <stdlib.h>
...
void Form2::changeOu...
I have this function in Visual C++ DLL
char * __stdcall GetMessage(int id) {
char buffer[250];
.
.
.
strcpy(buffer, entry); // entry is a char * that has allocated 250 chars
return (char *)buffer;
}
i am trying to import this function from C# with the following code
[DllImport("mydll.dll", CharSet=CharSet.Ansi)]
public static extern ...
I'm writing my own small multiprecision library, and while writing the method for subtraction, I encountered some weird error. Here is the code block I wrote for for multiprecision subtraction:
/* subtraction */
for (; p_aReverseIter != a.m_elements.rend(); ++p_aReverseIter, ++p_bReverseIter)
{
temp = static_cast<__int64>(static_ca...
Hi
I have a problem - when I'm trying to send huge amounts of data through posix sockets ( doesn't matter if it's files or some data ) at some point I don't receive what I expect - I used wireshark to determine what's causing errors, and I found out, that exactly at the point my app breaks there are packets marked red saying "zero windo...
I get error TryEnterCriticalSection undeclared identifier during compilation. Visual studio knows about the function but the compiler does not. Other Critical Section functions are defined. I have included #define _WIN32_WINNT 0x0400 in stdafx.h per msdn. Definition in winbase.h is surrounded by #if(_WIN32_WINNT >= 0x0400) #endif /* ...
So here is the story. I have this device that uses Linux and more open source tools(btw its an ARM). And I was given the task of creating some magic cashier application with it.
I have done it and now my boss have made a new request. He wants me to make that stuff(the device) connect to a remote database(preferably Oracle). So thats wha...
Since there is no .resize() member function in C++ std::map I was wondering, how one can get a std::map with at most n elements.
The obvious solution is to create a loop from 0 to n and use the nth iterator as the first parameter for std::erase().
I was wondering if there is any solution that does not need the loop (at least not in my ...
Does anyone know of a Windows user-mode thread synchronization library for C++ (utilizing spin locks / atomic operations)? I only need mutexes (~critical sections), but condition variables would be a plus.
...
Hello all,
It is often hard to find the origin of a NaN, since it can happen at any step of a computation and propagate itself.
So is it possible to make a C++ program halt when a computation returns NaN or inf? The best in my opinion would be to have a crash with a nice error message:
Foo: NaN encoutered at Foo.c:624
Is something li...
Hi all,
I am looking for a library to get some information from the active windows. By "information" I mean the absolute/relative position of the window, the size, the list of all the windows.
There is a function in GTK+ called get_window_list_toplevels() or get_root_window() but I get only the windows information realized with GTK.
I...
Some people suggested Doxygen, some ccdoc, which should be more similar to javadoc but is less supported. What's your opinion?
...
Whenever I find myself needing to serialize objects in a C++ program, I fall back to this kind of pattern:
class Serializable {
public:
static Serializable *deserialize(istream &is) {
int id;
is >> id;
switch(id) {
case EXAMPLE_ID:
return new ExampleClass(is);
//...
...
Hello, I was wondering which are the differences between declaring and implementing a class solely in a header file, compared with normal approach in which you protype class in the header and implement in effective .cpp file.
To explain better what I'm talking about I mean differences between normal approach:
// File class.h
class MyCl...
I am trying to replace new/delete with my own allocator(s). So, overriding placement new and delete - quite happy with that. Looks something like this ...
void* operator new( size_t size, Allocator* a )
{
return a->Alloc( size );
}
template<class T> inline void MyDelete( T* p, Allocator* a )
{
if( p )
{
p->~T();
...
I am trying to change a certain text box message. It will display my output.
This is what I have in my TCPClient()
#include "form2.h"....string recvMSG = "random";
QString s1 = QString::fromLocal8Bit(recvMSG.c_str());
182:: Form2::changeOutput(s1);
within my form2.h I have:
...
void Form2::changeOutput(QString &s)
{
o...
I am struggling to find out why I can't get transform to work with a template class.
Here's a simplified version of the template class :
template<typename T>
class base
{
public :
base() : all_() {}
~base() {}
public:
bool add(T t)
{
typename vector<T>::iterator itr
= lower_bound(all_.begin(), all_.end(), t);
i...
I'm doing some work with Genetic Algorithms and want to write my own GA classes. Since a GA can have different ways of doing selection, mutation, cross-over, generating an initial population, calculating fitness, and terminating the algorithm, I need a way to plug in different combinations of these. My initial approach was to have an abs...
I read a few posts on the usage of static and dynamic casts specifically from http://stackoverflow.com/questions/332030/when-should-staticcast-dynamiccast-and-reinterpretcast-be-used
I have a doubt regarding the usage of cast in the following manner. Can someone verify the below mentioned code:-
This is upward casting in inheritance hi...