diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2008-02-05 11:55:28 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2008-02-05 11:55:28 +0000 |
commit | 416c8d8c4c21a487a07f0928db6d301d57ee0839 (patch) | |
tree | 55a634980988ec5534c0cf81a0f2b02ed0cba495 | |
parent | 6772f4fe0ac17da3dd65e4ba6fd72c2d6e85bc84 (diff) |
INTEGRATION: CWS l10ntooling10 (1.39.18); FILE MERGED
2008/01/04 13:11:03 ihi 1.39.18.1: #i84991# Fixed several nfs multi plattform build issues
-rw-r--r-- | transex3/source/export2.cxx | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/transex3/source/export2.cxx b/transex3/source/export2.cxx index f20fdf497df2..40bdf73ef62d 100644 --- a/transex3/source/export2.cxx +++ b/transex3/source/export2.cxx @@ -4,9 +4,9 @@ * * $RCSfile: export2.cxx,v $ * - * $Revision: 1.39 $ + * $Revision: 1.40 $ * - * last change: $Author: vg $ $Date: 2007-09-20 15:02:34 $ + * last change: $Author: ihi $ $Date: 2008-02-05 12:55:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -352,6 +352,49 @@ void Export::RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename ){ aHash[ rPrj ] = !aFlagfile.Exists(); return aHash[ rPrj ];*/ //} +bool Export::CopyFile( const ByteString& source , const ByteString& dest ) +{ +// cout << "CopyFile( " << source.GetBuffer() << " , " << dest.GetBuffer() << " )\n"; + const int BUFFERSIZE = 8192; + char buf[ BUFFERSIZE ]; + + FILE* IN_FILE = fopen( source.GetBuffer() , "r" ); + FILE* OUT_FILE = fopen( dest.GetBuffer() , "w" ); + + if( IN_FILE == NULL ) + { + cerr << "Export::CopyFile WARNING: Could not open " << source.GetBuffer() << "\n"; + return false; + } + if( OUT_FILE == NULL ) + { + cerr << "Export::CopyFile WARNING: Could not open/create " << dest.GetBuffer() << " for writing\n"; + return false; + } + + while( fgets( buf , BUFFERSIZE , IN_FILE ) != NULL ) + { + if( fputs( buf , OUT_FILE ) == EOF ) + { + cerr << "Export::CopyFile WARNING: Write problems " << source.GetBuffer() << "\n"; + fclose( IN_FILE ); + fclose( OUT_FILE ); + return false; + } + } + if( ferror( IN_FILE ) ) + { + cerr << "Export::CopyFile WARNING: Read problems " << dest.GetBuffer() << "\n"; + fclose( IN_FILE ); + fclose( OUT_FILE ); + return false; + } + fclose ( IN_FILE ); + fclose ( OUT_FILE ); + + return true; +} + /*****************************************************************************/ void Export::UnquotHTML( ByteString &rString ) /*****************************************************************************/ |