« クリエティブ・コモンズ | メイン | C++でWinINet »
2005年01月20日
mixi Alert 開発日誌:: バッファからの行読み込み
Tweet @jin1016をフォロー自作の関数ではなく、STLのstrstreamとgetlineを使えば、簡単に実現できることが判明。
次のような感じ。
char *read_buff = new char[html_size];
unsigned long read_size_all;
// read_buffへWinINetを使って読み込み処理
std::istrstream read_stream( read_buff, read_size_all );
while( std::getline( read_stream, line ) )
{// 何か処理
}
std::istrstreamではなく、std::strstreamにしたらなぜかうまくいかなかった。(これでしばらく悩んだ)
std::ios::in を指定すれば同じだと思っていたのだが、違うのだろうか?
まあ、出来たからいいか。
投稿者 Takenori : 2005年01月20日 07:02
comments powered by Disqus