James Bott wrote:As Gilbert discovered, some cState values are too large to be retrieved from an INI file, thus they are truncated. Gilbert has not yet been able to compile a revised C program to correct the problem. But, it will happen as soon as we can get some guidance from a C programmer.
This is a working sample:
- Code: Select all Expand view RUN
- #include "Fivewin.ch"
FUNCTION MAIN()
LOCAL cContent := "[Test]" + CRLF + "Test=" + REPLICATE( "x", 2048 )
MEMOWRIT( "test.ini", cContent )
? LEN( GETPVPROFSTRING( "Test", "Test", "", ".\test.ini" ) )
RETURN NIL
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
#include "clipapi.h"
#ifdef __HARBOUR__
HB_FUNC( GETPVPROFSTRING )
#else
HB_FUNC( GETPVPROFS )
#endif
{
BYTE bBuffer[ 4096 ];
DWORD wLen;
wLen = GetPrivateProfileString( hb_parc( 1 ), // Section
IF( ISCHAR( 2 ), hb_parc( 2 ), 0 ), // Entry
hb_parc( 3 ), // Default
( char * ) bBuffer, // Destination Buffer
sizeof( bBuffer ) - 1, // M x Len
hb_parc( 4 ) ); // INI File
if( wLen )
hb_retclen( ( char * ) bBuffer, wLen );
else
hb_retc( "" );
}
#pragma ENDDUMP
EMG