i want to init QStringList through a function,
my code:
why it report "Segmentation fault"? do i misunderstand the class?Code:
QStringList qs; initqstringlist(&qs); the func is: { qs->append("1"); //Segmentation fault qs->append("2"); }
Printable View
i want to init QStringList through a function,
my code:
why it report "Segmentation fault"? do i misunderstand the class?Code:
QStringList qs; initqstringlist(&qs); the func is: { qs->append("1"); //Segmentation fault qs->append("2"); }
probably QStringList qs; is out of scope and since qs is created on stack, it automatically is deleted.
you mast transmit to your initqstringlist valid pointer
and what is this declaration meant:
int void initqstringlist()
???
Attach minimal compilable example please.
no, it should work fine.
can you show as compilable example?
i figured it out .
i use memset() before.
thank everyone.