PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: CiniFile  (Read 325 times)

SeaVipe

  • FireFly3 User
  • Junior Member
  • *
  • Posts: 129
  • Windows 10
CiniFile
« on: August 13, 2018, 11:54:02 PM »

Hi Josť,
Code: [Select]
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.
Logged
Clive Richey

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8641
  • Windows 10
    • PlanetSquires Software
Re: CiniFile
« Reply #1 on: August 14, 2018, 10:11: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

Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • Moderator
  • Master Member
  • *****
  • Posts: 3111
    • Jos
Re: CiniFile
« Reply #2 on: August 14, 2018, 10:51: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.