how to solve this error:
error C2664: 'strcpy' : cannot convert parameter 1 from 'class CString' to 'char *'


when I am using
strcpy(StdGrades.StudentName, this->m_StudentName);

StdGrades is a struct, StudentName is a CString type, m_StudentName is a CString variable.


Actually it is from: http://www.functionx.com/visualc/fileprocessing/cppserialization.htm
there is only one error

Hummmm -- why don't you just use CString's assignment operator? strcpy() is for C-style character arrays, not c++ classes. The code in that link is incorrect -- you can not pass CString to strcpy() like that. You will stumble across quite a few printing errors like that in books because if either carelessness or lack of good proofreading by the publishes, authors and proofreaders.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.