diff options
Diffstat (limited to '')
-rw-r--r-- | src/file.h | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -39,6 +39,14 @@ namespace Bu | |||
39 | virtual bool isBlocking(); | 39 | virtual bool isBlocking(); |
40 | virtual void setBlocking( bool bBlocking=true ); | 40 | virtual void setBlocking( bool bBlocking=true ); |
41 | 41 | ||
42 | /** | ||
43 | * Create a temp file and return its handle | ||
44 | *@param sName (Bu::FString) Give in the form: "/tmp/tmpfileXXXXXXXX" | ||
45 | * It will alter your (sName) setting the 'X's to random | ||
46 | * characters. | ||
47 | *@param sFlags (const char *) Standard file flags 'rb'... etc.. | ||
48 | *@returns (Bu::File) A file object representing your temp file. | ||
49 | */ | ||
42 | inline static Bu::File tempFile( Bu::FString &sName, const char *sFlags ) | 50 | inline static Bu::File tempFile( Bu::FString &sName, const char *sFlags ) |
43 | { | 51 | { |
44 | int afh_d = mkstemp( sName.getStr() ); | 52 | int afh_d = mkstemp( sName.getStr() ); |
@@ -46,7 +54,17 @@ namespace Bu | |||
46 | return Bu::File( afh_d, sFlags ); | 54 | return Bu::File( afh_d, sFlags ); |
47 | } | 55 | } |
48 | 56 | ||
57 | /** | ||
58 | * Set the size of the file to (nSize). You can either grow or shrink | ||
59 | * the file. | ||
60 | *@param nSize (long) The new size of the file. | ||
61 | */ | ||
49 | void truncate( long nSize ); | 62 | void truncate( long nSize ); |
63 | |||
64 | /** | ||
65 | * Change the file access permissions. | ||
66 | *@param t (mode_t) The new file access permissions. | ||
67 | */ | ||
50 | void chmod( mode_t t ); | 68 | void chmod( mode_t t ); |
51 | 69 | ||
52 | private: | 70 | private: |