cannot convert from 'std::string' to 'LPSTR'

前端 未结 6 2066
故里飘歌
故里飘歌 2020-12-09 16:12

As I clould not pass LPCSTR from one function to another (Data get changed) I tried passing it as a string.

But later I need to again convert it back to LPSTR. While

6条回答
  •  北海茫月
    2020-12-09 17:11

    If the function, you are calling does not write to string, but only reads it, then you can simply use string::c_str method. If it is going to write something, then you probably should ensure that your string has enough space by calling string::reserve().

提交回复
热议问题