[C++-sig] Re: Problem with embedding python with boost.python
Dirk Gerrits
dirk at gerrits.homeip.net
Mon Jul 7 11:44:40 CEST 2003
Dirk Gerrits wrote:
> command.latin1() is not null-terminated I think, which would make the
> strcpy fail. (Not sure, I don't use Qt.) Wouldn't it be easier and safer
> to do:
>
> QString cmd = command + '\0';
> ...
> PyObject *obj = PyRun_String(cmd.latin1(), Py_file_input,
> main_namespace.ptr(), main_namespace.ptr());
>
> ?
Ah I just read that latin1() DOES provide a null-terminated string. Sorry.
But then I don't understand why you were copying it in the first place.
Care to elaborate?
Regards,
Dirk Gerrits
More information about the Cplusplus-sig
mailing list