Olá Itamar,
Esse erro TERM/2014 se dá no ambiente do Letodb.
quanto ao erro 3 - Doserror 3 - Path not found.
SET(24, "TESTE.TXT", .F.)
quanto ao erro 23 - Doserror 123 - 123 Illegal character or invalid file-system name.
SET(24, cPath + "TESTE.TXT", .F.)
O arquivo dbleto.ini está adequadamente configurado, inclusive tudo funciona normal no ambiente leto, criação de tabelas, indice, etc.
Não encontrei qualquer menção na internet a respeito da resolução desse erro:
(SET(24, (xarquivo), .F.) ou SET PRINT TO (xArquivo) no ambiente Leto.
Acredito eu, que seja a mesma situação que ocorre com Fcreate() no ambiente Leto, função essa
que foi substituida, no ambiente Leto pela Leto_Fcreate().
Examinando os fontes do Leto, observei que Leto_Set(), retorna Set(), sem qualquer outro tratamento de criação de arquivo TERM no ambiente Leto.
Código: Selecionar todos
//server.prg
FUNCTION leto_Set( nSet, xPar1, xPar2 )
RETURN Set( nSet, xPar1, xPar2 )
no Harbour a função em C, para SET_PRINTFILE
Código: Selecionar todos
static void open_handle( PHB_SET_STRUCT pSet, const char * file_name,
HB_BOOL fAppend, HB_set_enum set_specifier )
{
HB_STACK_TLS_PRELOAD
PHB_ITEM pError = NULL;
PHB_FILE handle, * handle_ptr;
HB_ERRCODE uiError;
const char * szDevice = NULL, * def_ext;
char * szFileName = NULL;
char ** set_value;
HB_BOOL fPipe = HB_FALSE, fStripEof;
HB_TRACE( HB_TR_DEBUG, ( "open_handle(%p, %s, %d, %d)", ( void * ) pSet, file_name, ( int ) fAppend, ( int ) set_specifier ) );
switch( set_specifier )
{
case HB_SET_ALTFILE:
uiError = 2013;
set_value = &pSet->HB_SET_ALTFILE;
handle_ptr = &pSet->hb_set_althan;
def_ext = ".txt";
break;
case HB_SET_PRINTFILE:
uiError = 2014;
set_value = &pSet->HB_SET_PRINTFILE;
handle_ptr = &pSet->hb_set_printhan;
def_ext = ".prn";
break;
case HB_SET_EXTRAFILE:
uiError = 2015;
set_value = &pSet->HB_SET_EXTRAFILE;
handle_ptr = &pSet->hb_set_extrahan;
def_ext = ".prn";
break;
default:
return;
}
if( file_name && file_name[ 0 ] != '\0' )
{
#if defined( HB_OS_UNIX )
fPipe = file_name[ 0 ] == '|';
if( fPipe )
szFileName = hb_strdup( file_name );
else
#endif
{
szDevice = is_devicename( file_name );
if( szDevice )
{
szFileName = hb_strdup( szDevice );
def_ext = NULL;
#if defined( HB_OS_WIN ) || defined( HB_OS_DOS )
fAppend = HB_TRUE;
#endif
}
else
szFileName = hb_strdup( file_name );
}
}
/* free the old value before setting the new one (CA-Cl*pper does it).
* This code must be executed after setting szFileName, [druzus]
*/
close_handle( pSet, set_specifier );
if( *set_value )
{
hb_xfree( *set_value );
*set_value = NULL;
}
if( ! szFileName )
return;
fStripEof = fAppend && szDevice == NULL && ! fPipe;
/* Open the file either in append (fAppend) or truncate mode (! fAppend), but
always use binary mode */
/* QUESTION: What sharing mode does Clipper use ? [vszakats] */
do
{
if( fPipe )
handle = hb_filePOpen( szFileName + 1, "w" );
else
handle = hb_fileExtOpen( szFileName,
hb_stackSetStruct()->HB_SET_DEFEXTENSIONS ? def_ext : NULL,
( ! fStripEof || set_specifier == HB_SET_PRINTFILE ? FO_WRITE : FO_READWRITE ) |
FO_DENYWRITE | FXO_SHARELOCK |
( fAppend ? FXO_APPEND : FXO_TRUNCATE ) |
( szDevice ? 0 : FXO_DEFAULTS ),
NULL, pError );
if( handle == NULL )
{
pError = hb_errRT_FileError( pError, HB_ERR_SS_TERMINAL, EG_CREATE, uiError, szFileName );
if( hb_errLaunch( pError ) != E_RETRY )
break;
}
}
while( handle == NULL );
if( pError )
hb_itemRelease( pError );
if( handle != NULL && fStripEof )
{
/* Position to EOF */
if( hb_fileSeek( handle, 0, FS_END ) > 0 )
{
/* Special binary vs. text file handling - even for UN*X, now
that there's an HB_SET_EOF flag. */
/* PRINTFILE is always binary and needs no special handling. */
if( set_specifier != HB_SET_PRINTFILE )
{
/* All other files are text files and may have an EOF
('\x1A') character at the end (both UN*X and non-UN*X,
now that theres an HB_SET_EOF flag). */
char cEOF = '\0';
hb_fileSeek( handle, -1, FS_END ); /* Position to last char. */
hb_fileRead( handle, &cEOF, 1, -1 ); /* Read the last char. */
if( cEOF == '\x1A' ) /* If it's an EOF, */
hb_fileSeek( handle, -1, FS_END ); /* Then write over it. */
}
}
}
/* user RT error handler can open it too so we have to
* close it again if necessary
*/
if( handle == NULL )
{
hb_xfree( szFileName );
szFileName = NULL;
}
close_handle( pSet, set_specifier );
*handle_ptr = handle;
if( *set_value )
hb_xfree( *set_value );
*set_value = szFileName;
}
int hb_setUpdateEpoch( int iYear )
{
if( iYear >= 0 && iYear < 100 )
{
int iEpoch = hb_setGetEpoch();
int iCentury = iEpoch / 100;
if( iYear < iEpoch % 100 )
++iCentury;
iYear += iCentury * 100;
}
return iYear;
}
Resultando que Set(24,..), não tem tratamento adequado no ambiente Leto.