I made a class that gives main menu's sub menus and i want to write them to serial port but i can't make it happen.
#ifndef MENU_H
#define MENU_H
#include <iostream> //for std::string
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdlib.h>
#include <stdio.h>
#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif
#include "rs232.h"
#ifdef __cplusplus
}
#endif
#include "rs232.h"
using namespace std;
class Menu{
    Menu *upMenu;
    Menu *downMenu;
    Menu *rightMenu;
    string MenuName;
    public:
        Menu(); //default constructor
        ~Menu(); //default destructor
        void setUpMenu(Menu *);
        void setDownMenu(Menu *);
        void setRightMenu(Menu *);
        Menu* getUpMenu(Menu *);
        Menu* getDownMenu(Menu *);
        Menu* getRightMenu(Menu *);
        void printMenu(Menu *);
        void setMenuName(std::string);
        void getMenuName(Menu *);
};
#endif
This is my header file and below is where i try to write it to serial port so far.
 void Menu::getMenuName(Menu *menuName)
{     
    char *name = menuName->MenuName;
    RS232_cputs(17, name);
    cout<<menuName->MenuName<<endl;        
}
i can write menuName to console by cout bu cant write with RS232_cputs. It gave me this error => error: cannot convert ‘std::__cxx11::string {aka std::__cxx11::basic_string}’ to ‘char*’ in initialization char *name = menuName->MenuName;
And below is RS232_cputs func.
void RS232_cputs(int comport_number, const char *text)  /* sends a string to serial port */
{
  while(*text != 0)   RS232_SendByte(comport_number, *(text++));
}
