Subj : mixing c/c++ (revised [2] ) To : borland.public.cpp.borlandcpp From : "Rob C" Date : Fri Jul 18 2003 11:00 am It’s better, but it still doesn’t work. Would someone please just take the time to write in the code to make this work. I’ve been screwin’ around with this damn thing far too long but still nothing works and I’m getting so frustrated! In this program, C++ (Borland example program) passes to C which initializes the char array [I’ll go with char, and not string], returns to C++ and is passed to another C which “cats” onto that same char array, which then returns and C++ prints it in a window. Info :Making... Info :Making... Info :Compiling C:\BC5\EXAMPLES\OWL\TUTORIAL\step01.cpp Error: step01.cpp(62,3):Cannot convert 'char ( *)[25]' to 'char *' Error: step01.cpp(62,3):Type mismatch in parameter 'AddString' in call to 'InitVars(char *)' Error: step01.cpp(63,3):Cannot convert 'char ( *)[25]' to 'char *' Error: step01.cpp(63,3):Type mismatch in parameter 'AddString' in call to 'AddToEnd(char *)' -=------------------- step01.cpp #include #include #include extern "C" int AddToEnd( char *AddString ); extern "C" int InitVars( char *AddString ); char AddString[25]; class TDrawWindow : public TWindow { public: TDrawWindow(TWindow* parent = 0); protected: // Override member function of TWindow bool CanClose(); // Message response functions void EvLButtonDown(uint, TPoint&); void EvRButtonDown(uint, TPoint&); DECLARE_RESPONSE_TABLE(TDrawWindow); }; DEFINE_RESPONSE_TABLE1(TDrawWindow, TWindow) EV_WM_LBUTTONDOWN, EV_WM_RBUTTONDOWN, END_RESPONSE_TABLE; TDrawWindow::TDrawWindow(TWindow* parent) { Init(parent, 0, 0); } bool TDrawWindow::CanClose() { return MessageBox("Do you want to save?", "Drawing has changed", MB_YESNO | MB_ICONQUESTION) == IDNO; } void TDrawWindow::EvLButtonDown(uint, TPoint&) { MessageBox("You have pressed the left mouse button", "Message Dispatched", MB_OK); } void TDrawWindow::EvRButtonDown(uint, TPoint&) { MessageBox("You have pressed the right mouse button", "Message Dispatched", MB_OK); } class TDrawApp : public TApplication { public: TDrawApp() : TApplication() {} void InitMainWindow() { InitVars( &AddString ); //<-- C code AddToEnd( &AddString ); //<-- C code SetMainWindow(new TFrameWindow(0, AddString, //"Sample ObjectWindows Program" new TDrawWindow)); } }; int OwlMain(int /*argc*/, char* /*argv*/ []) { return TDrawApp().Run(); } ----------------------------- Initvars.c ---------- #include #include int InitVars( char *AddString ) //Initialize Variables { //89 strcpy( AddString, "This is C++,"); return (0); } //89 -------------------------------- AddToEnd.c ------- #include #include int AddToEnd( char *AddString ) { //89 char message[] = " and this is C "; strcat( AddString, message ); return (0); } //89 ------------------------------------------ .