You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.8 KiB
45 lines
1.8 KiB
15 years ago
|
/***************************************************************************
|
||
12 years ago
|
* tdefileio.h
|
||
15 years ago
|
* -------------------
|
||
|
*
|
||
|
* Revision : $Id$
|
||
|
* begin : Tue Jan 29 2002
|
||
|
* copyright : (C) 2002 by Patrick Charbonnier
|
||
|
*
|
||
|
* email : pch@freeshell.org
|
||
|
*
|
||
|
***************************************************************************/
|
||
|
|
||
|
/* Load / save entire (local) files with nice diagnostics dialog messages.
|
||
|
* These functions load/save the whole buffer in one i/o call, so they
|
||
|
* should be pretty efficient.
|
||
|
*
|
||
|
* Author: Stefan Taferner <taferner@kde.org>
|
||
|
* This code is under GPL.
|
||
|
*/
|
||
12 years ago
|
#ifndef tdefileio_h
|
||
|
#define tdefileio_h
|
||
15 years ago
|
|
||
13 years ago
|
/** Load a file. Returns a pointer to the memory-block that contains
|
||
15 years ago
|
* the loaded file. Returns a NULL string if the file could not be loaded.
|
||
|
* If withDialogs is FALSE no warning dialogs are opened if there are
|
||
|
* problems.
|
||
|
* The string returned is always zero-terminated and therefore one
|
||
|
* byte longer than the file itself.
|
||
|
* If ensureNewline is TRUE the string will always have a trailing newline.
|
||
|
*/
|
||
14 years ago
|
TQString kFileToString(const TQString & fileName, bool ensureNewline = TRUE, bool withDialogs = TRUE);
|
||
15 years ago
|
|
||
|
/** Save a file. If withDialogs is FALSE no warning dialogs are opened if
|
||
|
* there are problems. Returns TRUE on success and FALSE on failure.
|
||
|
* Replaces existing files without warning if askIfExists==FALSE.
|
||
|
* Makes a copy if the file exists to filename~ if createBackup==TRUE.
|
||
|
*/
|
||
14 years ago
|
bool kCStringToFile(const TQCString & buffer, const TQString & fileName, bool askIfExists = FALSE, bool createBackup = TRUE, bool withDialogs = TRUE);
|
||
15 years ago
|
|
||
|
// Does not stop at NUL
|
||
14 years ago
|
bool kByteArrayToFile(const TQByteArray & buffer, const TQString & fileName, bool askIfExists = FALSE, bool createBackup = TRUE, bool withDialogs = TRUE);
|
||
15 years ago
|
|
||
|
|
||
12 years ago
|
#endif /* tdefileio_h */
|