Memowrite - ESC character

Memowrite - ESC character

Postby Otto » Thu Nov 20, 2008 10:31 am

Copying dbf-files with memoread/memowrit adds a chr(26) (ESC character) at the end of the file.
Could this cause problems?
How can I add this C function to my FWPPC program?

Thanks in advance
Otto



Code: Select all  Expand view
#pragma BEGINDUMP

#include <hbapi.h>
#include <hbapiitm.h>
#include "hbapifs.h"

HB_FUNC( MEMOWRIT )
{
PHB_ITEM pFileName = hb_param( 1, HB_IT_STRING );
   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 )
{
FHANDLE fhnd = hb_fsCreate( ( BYTE * ) hb_itemGetCPtr( pFileName ), FC_NORMAL );

   if( fhnd != FS_ERROR )
{
ULONG ulSize = hb_itemGetCLen( pString );

   bRetVal = ( hb_fsWriteLarge( fhnd, ( BYTE * ) hb_itemGetCPtr( pString ), ulSize ) == ulSize );

/* NOTE: CA-Clipper will add the EOF even if the write failed. [vszakats] */
/* NOTE: CA-Clipper will not return .F. when the EOF could not be written. [vszakats] */
#if ! defined(OS_UNIX_COMPATIBLE)
{
if( bWriteEof ) /* if true, then write EOF */
{
BYTE byEOF = HB_CHAR_EOF;

   hb_fsWrite( fhnd, &byEOF, sizeof( BYTE ) );
   }
}
#endif

hb_fsClose( fhnd );
   }
}

hb_retl( bRetVal );
   }

#pragma ENDDUMP

//----------------------------------------------------------------------------//
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Thu Nov 20, 2008 10:37 am

Otto,

>
Copying dbf-files with memoread/memowrit adds a chr(26) (ESC character) at the end of the file. Could this cause problems?
>

We have never tried it. Please try it and let us know if it works, thanks

> How can I add this C function to my FWPPC program?

Just add that code that you have published to your PRG :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Thu Nov 20, 2008 1:57 pm

Thank you, Antonio.

The dbf-files seems to work also with the ESC but to face no problems in future I prefer to copy without.

If I link the code I get following warnings:

c:\develop8\nextstb\mystb.c(13285) : warning C4129: 'd' : unrecognized character escape sequence
c:\develop8\nextstb\mystb.c(13285) : warning C4129: 'm' : unrecognized character escape sequence
* Application successfully built and all is working.

Regards,
Otto
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Thu Nov 20, 2008 2:09 pm

Otto,

Those warnings are caused as Harbour output .C files use "\" for paths, though "\\" should be used.

You can safely ignore them.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 17 guests