PlanetSquires Forums

Support Forums => José Roca Software => Topic started by: SeaVipe on August 14, 2018, 12:24:02 AM

Title: CiniFile
Post by: SeaVipe on August 14, 2018, 12:24:02 AM
Hi José,
Dim as CiniFile ini = "C:\BootTime\boottime.ini"
Dim as CWSTR s = Trim( frmMain.txtNotes.Text )
Dim as Boolean boo1 = ini.WriteValue( ct.Format("%Y-%m-%d"), Str(Time) & ".2", Space( 1 ) & s )
Results in the following Error:C:\WinFBE_Suite\Sample_Projects\BootTimeTest\modMain.bas(81) error 98: Ambiguous call to overloaded function, WRITEVALUE() in 'dim as Boolean boo1 = ini.WriteValue( ct.Format("%Y-%m-%d"), Str(Time) & ".2", Space( 1 ) & s )'
Declare s as a String and the result is no error.
Title: Re: CiniFile
Post by: Paul Squires on August 14, 2018, 10:41:13 AM
Sometimes the "&" string concatenation causes issues with combining FB and CWSTR variables. Change it to the following and it should work:

Space( 1 ) + s

(or more technically correct)
WSpace( 1 ) + s

Title: Re: CiniFile
Post by: José Roca on August 14, 2018, 11:21:13 AM
The behaviour of the & operator, tailored to please nostalgics of VB6, can cause problems sometimes because it supports to concatenate numbers with strings. As CWSTR is not a string, but a pointer to a class, the compiler sometimes fails to ascertain if it has to convert the value of the pointer to a string or call the cast operator of the class.