PDA

View Full Version : Syntax confusion



baluk
11th December 2010, 15:04
Hi,

I have a syntax confusion with QList variable. I would like to ask you for the confirmation. My code is



VlcInstance::VlcInstance ( const QList< const char * > & args, QObject * parent = NULL) // Function syntax to pass my arguments.

const QList<const char *> *args = new QList<const char *>();
//preparation of the vlc command
const char* vlc_args[] = {"-I", "dummy"};
args->append(vlc_args);
VlcInstance(args, this); // I believe that I am passing pointer argument value which is the address



Though I have understanding with pointers, I am still confused as it has many pointers. I would really appreciate the correction with little bit of explanation. for future understanding.

wysota
11th December 2010, 15:08
First don't create the list through a pointer, especially that the VlcInstance requires an object and not a pointer to an object. Second of all is the idea of storing const char * items in the list your own? If so, change it asap to QString (which would make the whole parameter QStringList instead of QList<const char *>) or std::string.

baluk
11th December 2010, 15:28
is the idea of storing const char * items in the list your own?

No its not my idea. It was the class function defined in an external library which I downlaoded and linked to my project. So, can you correct me at passing const char* into List syntax If I am wrong.

wysota
11th December 2010, 15:58
I already did, see the first sentence of my post.