I have just added two variables to an object, which was already working, to a class of mine.. author and isbn. Here is a section of the code.
The errors are caused by the following linesCode:#include<iostream> #include<fstream> #include<stdlib> #include<time> #include<string> #include<ctype> #define KBYTE 1024 using namespace std; class bookobject { protected: //new fields here which means char name[KBYTE]; //changeing the edit function char author[KBYTE]; //and books2file - char isbn[KBYTE]; //so new constructor << = int number; //and methods to access and change fields //keep getName() setName() getNumber() setNumber() private: public: bookobject(void) { strcpy(name, ""); strcpy(author, ""); strcpy(isbn, ""); number = -1; }
char author[KBYTE];
char isbn[KBYTE];
I get these errors for both lines
1."Cannot convert 'std::basic_string<char,std::string_char_traits<ch ar>,std::allocator<char>>' to 'char *'
2."Type mismatch in parameter '_dest' in call to 'strcpy(char *, const char *)'
Hope that's the relevent bit, didn't want to post the whole lot. Thanks! (Full code attached if needed!)



LinkBack URL
About LinkBacks


