mysql_row[]取值转换问题,急!
c语言中用mysql_row[]取mysql数据库中的值后(数据库中为浮点型),因为取出的值是字符串型(应该是字符串吧,用%S能打印),但我需要将取出的值转为浮点型进行计算处理,字符串无法处理,但不知道怎么转换,用atof函数转换也不正确,恳请高人!! 急~ 谢谢~~
------解决方案--------------------
MYSQL_RES This structure represents the result of a query that returns rows (SELECT, SHOW, DESCRIBE, EXPLAIN). The information returned from a query is called the result set in the remainder of this section.
MYSQL_ROW This is a type-safe representation of one row of data. It is currently implemented as an array of counted byte strings. (You cannot treat these as null-terminated strings if field values may contain binary data, because such values may contain null bytes internally.) Rows are obtained by calling mysql_fetch_row().
根据手册很清楚,MYSQL_ROW 就是一个string, 如果你想处理数据,建议用MYSQL_RES
用mysql_query 执行你的select 然后用 mysql_store_result来处理。网上找个例子参考一下。