FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ini file - function to get all key-value for a section
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
ini file - function to get all key-value for a section
Posted: Thu Nov 10, 2022 10:50 AM
What is the function to retrieve all pair of keys and values under a specific section?
Is it this? https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getprivateprofilesection

TIA
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: ini file - function to get all key-value for a section
Posted: Thu Nov 10, 2022 01:56 PM
This returns all the keys of a section:
Code (fw): Select all Collapse
FUNCTION GETPVPROFSECTION( cSection, cIniFile )

    LOCAL cKeys := STRTRAN( GETPVPROFSTRING( cSection, , "", cIniFile ), CHR( 0 ), CRLF )

    LOCAL aKeys := {}

    LOCAL i

    FOR i = 1 TO MLCOUNT( cKeys )
        AADD( aKeys, RTRIM( MEMOLINE( cKeys, , i ) ) )
    NEXT

    RETURN aKeys
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: ini file - function to get all key-value for a section
Posted: Fri Nov 11, 2022 01:58 AM

Thank you very much Enrico

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion