UNIXプログラミング質問すれ
■ このスレッドは過去ログ倉庫に格納されています
0609608
NGNGclass tmpfilebuf : public filebuf
{
public:
tmpfilebuf()
{
FILE* fp = tmpfile();
int fd = fileno();
int mfd = dup(fd);
::fclose(fp);
::close(fd); // これは不要かもしれない…
this->attach(mfd);
}
tmpfilebuf(const tmpfilebuf& src)
{
int mfd = dup(src.fd());
this->attach(mfd);
}
virtual ~tmpfilebuf()
{
::close(this->fd());
}
};
■ このスレッドは過去ログ倉庫に格納されています