GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 17-May-2008, 04:55
sapan_shah143 sapan_shah143 is offline
New Member
 
Join Date: May 2008
Posts: 11
sapan_shah143 is on a distinguished road

error C2440: '=' : cannot convert from 'BOOL (__cdecl *)(void *)' to 'BOOL'


hi every one i have one error
the code for this is

BOOL bStatus;

BOOL WriteByte(void * );

i am calling this function by

bStatus = WriteByte(& ResponsePDU);

where ResponsePDU is a structure.

can anyone help regarding this. error come at shown by arrow
  #2  
Old 17-May-2008, 09:05
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,113
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: error C2440: '=' : cannot convert from 'BOOL (__cdecl *)(void *)' to 'BOOL'


Quote:
Originally Posted by sapan_shah143
..can anyone help...

It means that your compiler has detected an error in your program. Since we can't see your program, how could we guess?

On the other hand, I have created a program that provides an answer for the most important question in the universe:

CPP / C++ / C Code:
#include <iostream>
#include <windows.h>

using namespace std;

struct RespPDU {
    unsigned char  m_x;
};


BOOL WriteByte(void *x)
{
    RespPDU * r = (RespPDU *)x;
    cout << "'" << r->m_x 
         << "' (That's " << int(r->m_x) << " for you Earthlings.)" 
         << endl;
    return (cout.good());
}

int main()
{
    RespPDU ResponsePDU = {'*'};
    BOOL bStatus;

    cout << "The answer is ";
    bStatus = WriteByte(&ResponsePDU);

    cout << endl << "bStatus = " << bStatus << endl;
    return 0;
}


Output
Code:
The answer is '*' (That's 42 for you Earthlings.) bStatus = 1

So, now that we have the answer; I am still looking for the question.

Regards,

Dave
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Drawing Program Max_Payne C++ Forum 13 23-Dec-2007 18:06
Help with some functions baka_yaro C++ Forum 3 14-Mar-2007 05:56
need help with a console menu system BullBuchanan C++ Forum 6 20-Aug-2006 14:46
bool and Boolean alcoholic C++ Forum 8 04-Feb-2006 05:07
Help with syntax errors PeteGallo C Programming Language 7 08-Aug-2005 20:30

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:11.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.