Click here to Skip to main content
15,888,322 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Displaying the output of another program Pin
Richard MacCutchan29-Aug-14 6:05
mveRichard MacCutchan29-Aug-14 6:05 
Questionbattleship game code using c language Pin
Member 1104199227-Aug-14 20:37
Member 1104199227-Aug-14 20:37 
AnswerRe: battleship game code using c language Pin
Richard MacCutchan27-Aug-14 22:15
mveRichard MacCutchan27-Aug-14 22:15 
AnswerRe: battleship game code using c language Pin
Member 1048772029-Aug-14 0:30
Member 1048772029-Aug-14 0:30 
QuestionTEventLogger Pin
Zdravko Donev25-Aug-14 9:34
Zdravko Donev25-Aug-14 9:34 
AnswerRe: TEventLogger Pin
Freak3027-Aug-14 1:25
Freak3027-Aug-14 1:25 
QuestionCMFCOutlookBar cannot return to pane 0. Pin
Drakesal25-Aug-14 0:12
Drakesal25-Aug-14 0:12 
Questionhow to pass a function which has variable arguments as template argument? Pin
Falconapollo24-Aug-14 5:37
Falconapollo24-Aug-14 5:37 
I want to write a adapter which can convert non static member functions to C-sytle function pointers. Here is what I got now(see the following code snippet), but the current solution is not general. I want to make
C++
int (T::*Func)(int)
accept variable arguments. but i'm stuck here? anybody can help me?

and it's necessary to make
C++
int f()
and
C++
int display
have the same signature.

The final goal is Interfacing C++ member functions with C libraries.

C++
class StoreVals
    {
        int val;
    public:
        int display(int k) { cout << k << endl; return 0; }
    };

template<class T, int (T::*Func)(int) >
class CObjectT
{
public:
    /*
     the signagure of f(...) should change by the argument of template. they must be the same, but i don't know how to achieve this goal
    */
    static int f(int i)
    { 
        T obj;
        return (obj.*Func)(i);
    }
};

void main()
{
 CObjectT<StoreVals, &StoreVals::display>::f(7);
 auto function_t = &CObjectT<StoreVals, &StoreVals::display>::f;
 cout << typeid(function_t).name() << endl; // now it's a c-style function pointer
}

AnswerRe: how to pass a function which has variable arguments as template argument? Pin
jschell25-Aug-14 10:30
jschell25-Aug-14 10:30 
QuestionHow to ShellExecute a PDF to a specific page Pin
DanYELL23-Aug-14 17:28
DanYELL23-Aug-14 17:28 
AnswerRe: How to ShellExecute a PDF to a specific page Pin
enhzflep23-Aug-14 17:58
enhzflep23-Aug-14 17:58 
AnswerRe: How to ShellExecute a PDF to a specific page Pin
Richard MacCutchan23-Aug-14 22:30
mveRichard MacCutchan23-Aug-14 22:30 
AnswerRe: How to ShellExecute a PDF to a specific page Pin
Graham Breach23-Aug-14 23:00
Graham Breach23-Aug-14 23:00 
QuestionRe: How to ShellExecute a PDF to a specific page Pin
David Crow25-Aug-14 3:52
David Crow25-Aug-14 3:52 
Questionhow this error has generated -c program? Pin
mybm122-Aug-14 20:33
mybm122-Aug-14 20:33 
QuestionRe: how this error has generated -c program? Pin
Richard MacCutchan22-Aug-14 21:07
mveRichard MacCutchan22-Aug-14 21:07 
AnswerRe: how this error has generated -c program? Pin
mybm122-Aug-14 22:42
mybm122-Aug-14 22:42 
GeneralRe: how this error has generated -c program? Pin
Richard MacCutchan23-Aug-14 0:16
mveRichard MacCutchan23-Aug-14 0:16 
Questioncan anyone suggest how to convert matlab code into c code..for resampling function Pin
mybm121-Aug-14 19:10
mybm121-Aug-14 19:10 
SuggestionRe: can anyone suggest how to convert matlab code into c code..for resampling function Pin
Richard MacCutchan21-Aug-14 21:50
mveRichard MacCutchan21-Aug-14 21:50 
GeneralRe: can anyone suggest how to convert matlab code into c code..for resampling function Pin
mybm121-Aug-14 23:11
mybm121-Aug-14 23:11 
GeneralRe: can anyone suggest how to convert matlab code into c code..for resampling function Pin
Richard MacCutchan21-Aug-14 23:23
mveRichard MacCutchan21-Aug-14 23:23 
GeneralRe: can anyone suggest how to convert matlab code into c code..for resampling function Pin
mybm121-Aug-14 23:25
mybm121-Aug-14 23:25 
GeneralRe: can anyone suggest how to convert matlab code into c code..for resampling function Pin
Richard MacCutchan22-Aug-14 0:19
mveRichard MacCutchan22-Aug-14 0:19 
GeneralRe: can anyone suggest how to convert matlab code into c code..for resampling function Pin
mybm122-Aug-14 0:21
mybm122-Aug-14 0:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.