FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index mod_harbour Funcion File()
Posts: 298
Joined: Fri Oct 07, 2005 05:20 AM
Funcion File()
Posted: Tue Apr 07, 2026 06:32 PM

Buen d铆a a tod@s :

Solamente he utilizado mod_harboour con la versi贸n Harbour 3.2.0dev (r2004201301) y ADS, no hab铆a tenido ning煤n problema hasta el d铆a de hoy.
Despu茅s de revisar todo el c贸digo fuente, he conclu铆do que la funci贸n FILE() no resuelve la siguiente ruta:

  • //SERVIDOR:Puerto/CARPETA/SUBCARAPETA/TABLA.DBF

La funci贸n devuelve falso, si omito el "puerto" la funci贸n devuelve True.

Los procesos funcionaban correctamente desde el a帽o 2022.

驴 Alguna sugerencia ?

Vikthor
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Funcion File()
Posted: Thu Apr 09, 2026 06:15 AM

Vikthor, I think you could try debugging the C implementation of Harbour鈥檚 FILE() function.

You don鈥檛 have to recompile the Harbour sources for this. Instead, you can debug it directly鈥攐r even replace it with your own extended version鈥攗sing a #pragma BEGINDUMP block inside your PRG file.

Here鈥檚 an example of a debugging version of FILE(): (from AI not tested!)

#pragma BEGINDUMP

#include "hbapi.h"
#include "hbapifs.h"
#include "stdio.h"   // for printf

// Custom FILE_DEBUG function
HB_FUNC( FILE_DEBUG )
{
    // 1. Get parameter as string
    PHB_ITEM pFileName = hb_param( 1, HB_IT_STRING );
    const char * szFileName = NULL;
    HB_BOOL bExist = FALSE;

if( pFileName && hb_itemType( pFileName ) & HB_IT_STRING )
{
    szFileName = hb_itemGetCPtr( pFileName );
    
    // Debug output: show the path being checked
    printf( "FILE_DEBUG: checking path -> '%s'\n", szFileName );
    fflush( stdout ); // flush immediately

    // 2. Call the original Harbour check
    //    hb_spFile is the internal C function used by FILE()
    bExist = hb_spFile( ( const char * ) szFileName, NULL );

    // Debug output: show the result
    printf( "FILE_DEBUG: result -> %s\n", bExist ? "EXISTS" : "DOES NOT EXIST" );
    fflush( stdout );
}
else
{
    printf( "FILE_DEBUG: ERROR - no string parameter received!\n" );
    fflush( stdout );
}

// Return result to Harbour
hb_retl( bExist );
}

#pragma ENDDUMP

Best regards,
Otto

Continue the discussion