From 322b785e7a686ea72f7c89e6ad9529a547c62eed Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 2 Oct 2008 17:02:36 +0000 Subject: More changes to File...turns out tempFile always opens the file for reading and writing...so...what more do you need? It was ignoring the open flags you gave it anyway. --- src/file.cpp | 2 +- src/file.h | 22 +++++++++++----------- src/unit/taf.cpp | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/file.cpp b/src/file.cpp index 417c445..9c8ae90 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -151,7 +151,7 @@ void Bu::File::setBlocking( bool bBlocking ) } #ifndef WIN32 -Bu::File Bu::File::tempFile( Bu::FString &sName, int /*iFlags*/ ) +Bu::File Bu::File::tempFile( Bu::FString &sName ) { int afh_d = mkstemp( sName.getStr() ); diff --git a/src/file.h b/src/file.h index a50d53c..84e0691 100644 --- a/src/file.h +++ b/src/file.h @@ -56,27 +56,27 @@ namespace Bu enum { // Flags - Read = 0x01, //< Open file for reading - Write = 0x02, //< Open file for writing - Create = 0x04, //< Create file if it doesn't exist - Truncate = 0x08, //< Truncate file if it does exist - Append = 0x10, //< Always append on every write - NonBlock = 0x20, //< Open file in non-blocking mode - Exclusive = 0x44, //< Create file, if it exists then fail + Read = 0x01, ///< Open file for reading + Write = 0x02, ///< Open file for writing + Create = 0x04, ///< Create file if it doesn't exist + Truncate = 0x08, ///< Truncate file if it does exist + Append = 0x10, ///< Always append on every write + NonBlock = 0x20, ///< Open file in non-blocking mode + Exclusive = 0x44, ///< Create file, if it exists then fail // Helpful mixes - ReadWrite = 0x03 //< Open for reading and writing + ReadWrite = 0x03 ///< Open for reading and writing }; /** - * Create a temp file and return its handle + * Create a temp file and return its handle. The file is opened + * Read/Write. *@param sName (Bu::FString) Give in the form: "/tmp/tmpfileXXXXXXXX" * It will alter your (sName) setting the 'X's to random * characters. - *@param sFlags (const char *) Standard file flags 'rb'... etc.. *@returns (Bu::File) A file object representing your temp file. */ #ifndef WIN32 - static Bu::File tempFile( Bu::FString &sName, int iFlags ); + static Bu::File tempFile( Bu::FString &sName ); /** * Set the size of the file to (nSize). You can either grow or shrink diff --git a/src/unit/taf.cpp b/src/unit/taf.cpp index 0a97eba..71bd867 100644 --- a/src/unit/taf.cpp +++ b/src/unit/taf.cpp @@ -29,7 +29,7 @@ public: { #define FN_TMP ("/tmp/tmpXXXXXXXX") Bu::FString sFnTmp(FN_TMP); - Bu::File fOut = Bu::File::tempFile( sFnTmp, Bu::File::Write ); + Bu::File fOut = Bu::File::tempFile( sFnTmp ); const char *data = "{test: name=\"Bob\"}" ; -- cgit v1.2.3