Is it possible to use a Mutex Object for a application which users c++ dll to do background work and a c# to display it. Bot these use a common resource ie db . So can Mutex be used to lock this resource. In my db c++ will insert to db and c# will read it.
...
Every Modern OS provides today some atomic operations:
Windows has Interlocked* API
FreeBSD has <machine/atomic.h>
Solaris has <atomic.h>
Mac OS X has <libkern/OSAtomic.h>
Anything like that for Linux?
I need it to work on most Linux supported platforms including: x86, x86_64 and arm.
I need it to work on at least GCC and Intel C...
What is the easiest way in Windows to get the location of a file?
I have a filename that was returned to me by the Windows function GetModuleName (returns the full name of a module (exe or dll)), and which could be in any valid filename format, e.g.
myfile.dll
c:\windows\myfile.dll
\?\c:\windows\myfile.dll (or something like this)
x:\...
I have a string in UCS-2 encoding. I need to copy this string to another UCS-2 string. Before copying I need to calculate the length of a UCS-2 string for memeory allocation.
How to calculate length of an UCS-2 string?
...
Hello,
I'm receiving a c-string as a parameter from a function, but the argument I receive is going to be destroyed later. So I want to make a copy of it.
Here's what I mean:
class MyClass
{
private:
const char *filename;
public:
void func (const char *_filename);
}
void MyClass::func (const char *_filename)
{
filename = _filenam...
I'd like to do this in a platform independant way, and I know libpng is a possibility, but I find it hard to figure out how. Does anyone know how to do this in a simple way?
...
Hi ,
Could someone please tell us if EWOULDBLOCK. works sendto()?
If yes! please give an example ... thanks!
If not, is there anything similar to accept error?
Thanks for your replies
...
Hi, i have
class Base
{
Base* next;
}
class Class1 : Base
{
}
Base* pBase = new Base();
Class1* pTest = new Class1();
pBase->next = pTest;
Class1* pClass1;
pClass1 = (Class1*)pBase->next;
I want to be able to write
pClass1 = pBase->next;
and get no compilation error C2440 (cannot convert). Or in other words I want pClass1 poi...
error C2664: 'strcpy' : cannot convert parameter 1 from 'TCHAR *' to 'char *'
code:
LPCTSTR name, DWORD value
strcpy (&this->valueName[0], name);
error C2664: 'strlen' : cannot convert parameter 1 from 'LPCTSTR' to 'const char *'
LPCTSTR name;
strlen (name)
The code above to a class which works fine in another project, I c...
Help find a library that implements:
1) Publisher-Subscribers. Publisher sends (SendMessage - not WinAPI function) the message, not knowing how many subscribers will receive it, maybe 0.
2) Asynchronously. If there is a free flow, the subscriber (s) must start in parallel with the code after the SendMessage.
3) Smart pointers to param...
Hi:)
I have a hindi script file like this:
3. भारत का इतिहास काफी समृद्ध एवं विस्तृत है।
I have to write a program which adds a position to each and every word in each sentence.
Thus the numbering for every line for a particular word position should start off with 1 in parentheses. The output should be something like this.
3. भारत...
I would like to get 2 random different elements from an std::vector. How can I do this so that:
It is fast (it is done thousands of times in my algorithm)
It is elegant
The elements selection is really uniformly distributed
...
Hi.
typedef void (__thiscall* LPVOIDPROC) (void);
class ClassA
{
LPVOIDPROC m_pProc;
void SetProc(LPVOIDPROC pProc) { m_pProc = pProc; }
void OnSomeEvent() { m_pProc(); }
}
class ClassB
{
ClassA* pCA;
void Proc() { /* ... */ }
void Init()
{
// Assume pCA != NULL
pCA->Set((LPVOIDPROC)&ClassB::Proc); // error ...
There are many questions discussing the details of C and C++ dealing with pointer-to-const deletion, namely that free() does not accept them and that delete and delete[] do and that constness doesn't prevent object destruction.
What I am interested on is whether you think it is a good practice to do so, not what the languages (C and C++...
Hello,
What is the difference/relationship between "extern" and "__declspec(dllimport")? I found that sometimes it is necessary to use both of them, sometimes one is enough.
Am I right that:
"extern" is for statically linked libraries,
"__declspec(dllimport)" is for DLL (dynamically linked libraries),
both do actually the same job fo...
Hello everybody,
i was wondering if somebody could help me out. I have a plan of making clone of geek tools for linux. But i have no idea if you can somehow use linux desktop as canvas for drawing text etc. I tried to google it up but i found nothing. What i need to do is basically be able to draw text on certain parts of desktop so it ...
#include<iostream>
using namespace std;
class Example
{
public:
Example(int a,int b,int c):m_a(a),m_b(b),m_c(c)
{ // Wrong indentation here due to the colon in above line, { should be under E
printf("\nThe 3 argument constructor invoked\n");
} // Wrong indentation again
private:
int m_a;
i...
Here's the setup.
I have a C++ program which calls several functions, all of which potentially throw the same exception set, and I want the same behaviour for the exceptions in each function
(e.g. print error message & reset all the data to the default for exceptionA; simply print for exceptionB; shut-down cleanly for all other exceptio...
I have a c++ program which performs one function. It loads a large data-file into an array, receives an array of integers and performs a lookup in that array, returning a single integer. I am currently calling the program with each integer as an argument, like so:
$ ./myprogram 1 2 3 4 5 6 7
I also have a ruby script, and I would like...
If a new type is declared whithin a class, like:
class foo {
public :
struct s1 {
int a ;
};
private :
struct s2 {
int b ;
};
};
then in what scope can the following statements be used:
s1 ss1;
s2 ss2;
Thanks in advance.
...