Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #9501

Re: Problem with GetPrivateProfileString()

From "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Problem with GetPrivateProfileString()
Date 2016-07-05 09:41 +0200
Organization A noiseless patient Spider
Message-ID <nlfobc$qcf$1@dont-email.me> (permalink)
References <0a08cc3b-7ab7-4a57-b9f2-ca872dc1f93d@googlegroups.com>

Show all headers | View raw


Hello Jürgen,

Until now I have not seen any problems with Windows 10 64 and VO 2.8.

Perhaps it is better to use Memalloc and copy the psz to a normal string 
before verifying as in the example below.

Does another process writes into the ini file at the same time? I have seen 
that this can create problems even if other entries of the file are changed.

Arne Ortlinghaus
ACS Data Systems


METHOD GetString (cSection, cEntry, cDefault, cFirmaID) CLASS IniFile
//p Liefert den Wert einer Variablen als String
//a cSection - String: Section
//a cEntry - String: Entry
//a cDefault - String für Defaultwert oder nil
//a cFirmaID - Falls angegeben: Lesen von einer ine speziellen Firma (falls 
Firmenverwaltung)
 LOCAL ptrBuffer as psz
 LOCAL cBuffer as STRING
 Default(@cDefault, "")
 ptrBuffer := MemAlloc (2049)
 GetPrivateProfileString (String2Psz(_cSubSection+cSection), 
String2Psz(cEntry), String2Psz(cDefault), ptrBuffer, ;
                2048, String2Psz(self:fullPath))
 cBuffer := Psz2String (ptrBuffer)
   MemFree (ptrBuffer)


 RETURN cBuffer


"Jürgen Knauf" <trotterklaus@googlemail.com> schrieb im Newsbeitrag 
news:0a08cc3b-7ab7-4a57-b9f2-ca872dc1f93d@googlegroups.com...
GetPrivateProfileString() is not workiung correctly.


When I try to read an empty value from an INI-File, I do not get the 
alternate value back.

pszFile   := "C:\Program Files (x86)\texManager 8\tm.ini"
pszBuffer := Space(127)

GetPrivateProfileString("PFADE","LOCALAPP","ABCDE",pszBuffer,127,pszFile)

? pszBuffer
In this case it must be "ABCDE", but I get an empty value.

Windows 10 64-Bit, Vo 2.8

Jürgen 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Problem with GetPrivateProfileString() Jürgen Knauf <trotterklaus@googlemail.com> - 2016-07-04 23:10 -0700
  Re: Problem with GetPrivateProfileString() "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> - 2016-07-05 09:41 +0200
  Re: Problem with GetPrivateProfileString() "Wolfgang Riedmann" <wriedmann@gmail.com> - 2016-07-05 11:24 +0200
  Re: Problem with GetPrivateProfileString() Jürgen Knauf <trotterklaus@googlemail.com> - 2016-07-06 00:55 -0700
  Re: Problem with GetPrivateProfileString() "Jean Raymond" <jean_ray67@hotmail.com> - 2016-07-07 08:10 -0400
    Re: Problem with GetPrivateProfileString() Jürgen Knauf <trotterklaus@googlemail.com> - 2016-07-08 04:18 -0700

csiph-web