Added an optional 3rd parameter to MEMOWRIT()

This commit is contained in:
Alejandro de Garate
2003-07-17 21:32:49 +00:00
parent b9985e9e48
commit 77d9572fd6
2 changed files with 16 additions and 4 deletions

View File

@@ -8,6 +8,11 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2003-07-17 17:34 UTC-0400 Alejandro de Garate <alex_degarate@hotmail.com>
* source/rtl/memofile.c
+ Added an optional 3rd parameter to MEMOWRIT(), <lWriteEof>, to decide
at run-time if EOF char should be written.
2003-07-16 13:00 UTC-0300 Antonio Carlos Pantaglione <toninho@fwi.com.br>
* contrib/rdd_ads/ads1.c
! Changes in adsPutValue for speed(). Tested with

View File

@@ -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