FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Harbour : USING [] OPERATOR FOR STRING ITEM:SOLVED
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Harbour : USING [] OPERATOR FOR STRING ITEM:SOLVED
Posted: Thu Sep 27, 2012 08:35 AM

Hello,

Converting to harbour is finished , now i try to run the aplication.

It doesn't , the aplication ends without warning or error on a line as :

? Datadir[1]

In xhb-dif.txt i found an example to show that harbour can work with this operator , it works

Also in mine aplication xhb.ch is present , xhb.lib is linked in.

I see no difference between the aplication and the sample from harbour.

Any sugestion is welcome

Frank

test
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Harbour : USING [] OPERATOR FOR STRING ITEMS
Posted: Fri Sep 28, 2012 04:51 PM

In my experience, cCharVar[ n ] works in xHarbour but does not work in Harbour. We need to convert it as SubStr( cCharVar, n, 1 )

Regards



G. N. Rao.

Hyderabad, India
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: Harbour : USING [] OPERATOR FOR STRING ITEMS : SOLVED !!!!!!
Posted: Sat Sep 29, 2012 08:10 AM

Hello ,

WARNING : HARBOUR HAS PROBLEMS WITH THE EXTENSIONS FROM XHARBOUR IN A INIT PROCEDURE !!!!!!!

Not working in a init procedure (at least) :

local Test := "Test"
? test[2]

Or FOR EACH (el IN {"A","B"})

I have solved it as

ifdef XHARBOUR

INIT PROCEDURE InitMyAplication()

else

PROCEDURE InitMyAplication()

endif

And then call this procedure in the main module

test
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: Harbour : USING [] OPERATOR FOR STRING ITEMS
Posted: Sun Sep 30, 2012 09:18 AM
nageswaragunupudi wrote:In my experience, cCharVar[ n ] works in xHarbour but does not work in Harbour. We need to convert it as SubStr( cCharVar, n, 1 )

No it works , but not in a init procedure. Compile with init procedure and without to see the difference

Code (fw): Select all Collapse
# include "fivewin.ch"
#ifndef __XHARBOUR__
  #include "xhb.ch" // add xHarbour emulation to Harbour  , call also hbcompat.ch
  # include "xhbcls.ch"
#endif
  proc Main()
  local s := "ABCDEFG"
  local a := {"A","C"}
  ? s, "=>", s[2], s[4], s[6]
  aIns(a,2,"B",.T.)
  ? a , ("B" IN a)
  s[2] := lower( s[2] )
  s[4] := lower( s[4] )
  s[6] := lower( s[6] )
  ?? " =>", s
return
*********************
INIT PROCEDURE Test
LOCAL test := "TEST"
local a := {"A","C"}
? test[2]
? ("C" IN a)
RETURN
test

Continue the discussion