How to get BLOB data using oracle ODBC
问题 I'm trying to get image that are stored in BLOB and then save it as jpg. Here i retrieve the binary data and save it in str; string str; SQLCHAR buf[500] = {0}; while ((SQL_SUCCEEDED(SQLGetData(StmtHandle, colnum, SQL_C_BINARY, buf, sizeof(buf), NULL)))) { string data(reinterpret_cast< const char* >(buf), reinterpret_cast< const char* >(buf) + sizeof(buf)); str = str + data; } Then i write it in the file ofstream file; file.open("C:\\Users\\tom\\Desktop\\img.jpeg"); file << str; file.close();