c++ - char* concatenation not working properly -


i ran issue wasn't able find solutin till now. have function should act string.concat in c#:

char* va(char* text, ...) {     char buffer[1000];     va_list parameters;     va_start(parameters, text);     vsprintf(buffer, text, parameters);     return buffer; } 

but reason if this:

for (int = 0; < 12; i++)     addoption(va("option %i", i)); 

the menu fields display "option 11", seems text overwriting. tried disableing "string pooling" in project settings, didn't change anything! appreciated!

you should use

char *buffer = new char[1000] 

for return of function char* va()need heap variable


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -