From 77d9572fd652da18d993f712fbe49f7e93059252 Mon Sep 17 00:00:00 2001 From: Alejandro de Garate Date: Thu, 17 Jul 2003 21:32:49 +0000 Subject: [PATCH] Added an optional 3rd parameter to MEMOWRIT() --- harbour/ChangeLog | 5 +++++ harbour/source/rtl/memofile.c | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ba462d446d..45906618f3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2003-07-17 17:34 UTC-0400 Alejandro de Garate + * source/rtl/memofile.c + + Added an optional 3rd parameter to MEMOWRIT(), , to decide + at run-time if EOF char should be written. + 2003-07-16 13:00 UTC-0300 Antonio Carlos Pantaglione * contrib/rdd_ads/ads1.c ! Changes in adsPutValue for speed(). Tested with diff --git a/harbour/source/rtl/memofile.c b/harbour/source/rtl/memofile.c index e716fadcdf..176ce471ec 100644 --- a/harbour/source/rtl/memofile.c +++ b/harbour/source/rtl/memofile.c @@ -110,8 +110,12 @@ HB_FUNC( MEMOREAD ) HB_FUNC( MEMOWRIT ) { PHB_ITEM pFileName = hb_param( 1, HB_IT_STRING ); - PHB_ITEM pString = hb_param( 2, HB_IT_STRING ); - BOOL bRetVal = FALSE; + PHB_ITEM pString = hb_param( 2, HB_IT_STRING ); + BOOL bWriteEof = TRUE; /* write Eof !, by default is .T. */ + BOOL bRetVal = FALSE; + + if( hb_parinfo(0) == 3 && ISLOG( 3 ) ) + bWriteEof = hb_parl( 3 ); if( pFileName && pString ) { @@ -127,9 +131,12 @@ HB_FUNC( MEMOWRIT ) /* NOTE: CA-Clipper will not return .F. when the EOF could not be written. [vszakats] */ #if ! defined(OS_UNIX_COMPATIBLE) { - BYTE byEOF = HB_CHAR_EOF; + if( bWriteEof ) /* if true, then write EOF */ + { + BYTE byEOF = HB_CHAR_EOF; - hb_fsWrite( fhnd, &byEOF, sizeof( BYTE ) ); + hb_fsWrite( fhnd, &byEOF, sizeof( BYTE ) ); + } } #endif