<used>false</used>
<version>3</version>
<includestyle>3</includestyle>
- <root>/usr/lib/qt-3.3</root>
+ <root>/usr/lib64/qt-3.3</root>
<designerintegration>EmbeddedKDevDesigner</designerintegration>
- <qmake>/usr/lib/qt-3.3/bin/qmake</qmake>
- <designer>/usr/lib/qt-3.3/bin/designer</designer>
+ <qmake>/usr/lib64/qt-3.3/bin/qmake</qmake>
+ <designer>/usr/lib64/qt-3.3/bin/designer</designer>
<designerpluginpaths/>
</qt>
</kdevcppsupport>
#include <string>
#include <stdio.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
+#include <fcntl.h>
#include <tmpfstream.hpp>
#include <filefunc.hxx>
tmpnametemplate.copy(chbuf,tmpnametemplate.size()+1);
chbuf[tmpnametemplate.size()]=0;
- // TODO: flags handling
+ // always assume out-mode, otherwise the tmpfstream would be useless
+ int flags=0;
+ if (mode & std::ios_base::in)
+ flags |= O_RDWR;
+ else
+ flags |= O_WRONLY;
+
+ if (mode & std::ios_base::app)
+ flags |= O_APPEND;
- int fd=mkstemp(chbuf);
+ int fd=mkostemp(chbuf,flags);
filename=chbuf;
delete[] chbuf;
unlink(".foobar");
}
+BOOST_AUTO_TEST_CASE(TmpfstreamReadWrite)
+{
+ tmpfstream tmpf("./tmp.XXXXXX",std::ios_base::out | std::ios_base::in );
+ BOOST_CHECK_EQUAL( true, tmpf.is_open() );
+
+ tmpf << "hello world" << endl;
+
+ tmpf.seekg(0);
+ string input;
+ getline(tmpf,input);
+
+ BOOST_CHECK_EQUAL( "hello world", input );
+
+ tmpf.unlink();
+ tmpf.close();
+}
BOOST_AUTO_TEST_SUITE_END()