Hello everyone.

I have already read the "MySQL C API Programming" tutorial found at: zetcode.com/tutorials/mysqlcapitutorial. The problem is, the tutorial does not show how a person would display the results obtained from the SELECT FROM statement in a char * format.

Does anyone know if it is possible to convert the results that are stored in a row array, (row, as in the MYSQL_ROW row datatype) into a char *?

I would like to display the results obtained from a row array, inside of a series of message boxes.

Please Note: I'm using Win32, not a console application..

Also note..
I already know how to display the results using printf, but not a messagebox, which requires the data that is inside of the row array to be converted into char * format before it can be displayed in a win32 app.

Thanks in advance.

Edited 6 Years Ago by PixelExchange: n/a

Very similar to the way you would do it with printf(), but use sprintf() to format the string in a character array, then send the character array to MessageBox() or whatever win32 api function you want. Note that if your program is compiled for UNICODE then you will have to use swprintf()

In c++ you could also use stringstream instead of sprintf().

This question has already been answered. Start a new discussion instead.