1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| void read()
{
std::string data("");
short retcode = KO;
SQLINTEGER taille_restante=0; // données restantes
while(retcode != OK)
{
char chunk[CBdd::CHUNK_SIZE];
retcode = getData(chunk, CBdd::CHUNK_SIZE, &taille_restante);
if (OK_MORE_TO_COME == retcode)
{
data.append(std::string(chunk).substr(0, CBdd::CHUNK_SIZE));
}
else if (OK == retcode)
{
data.append(std::string(chunk).substr(0, taille_restante));
}
}
std::fstream file;
file.open("test", std::ios::binary | std::ios::out);
std::ostream outStream(file.rdbuf());
outStream.write(data.c_str(), data.length());
} |
Partager