FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

FB II COMPILER

Emulate UNS$ with the mini-runtime



I'm trying to find how to use something like UNS$ in a mini-runtime app.

I need values ranging from 0 to 65535 instead of -32768 to 32767.

SG


I were you, I use toolbox. Try this.

LOCAL FN xUNS$(num%)
  DIM longnum&,t$

  longnum& = 0
  % @longnum&+2,num%
  CALL NUMTOSTRING(longnum&,@t$)
END FN = t$

WINDOW #1
PRINT FN xUNS$(&HFFFF)
DO
UNTIL LEN(INKEY$) OR MOUSE(_down)

Osamu Shigematsu


This is untested, but should be pretty close.

'---------------------
local FN cleanString$( theString$)
  while ( left$( theString$) = " ") or ( left$( theString$) = "0")
    theString$ = right$( theString$, len( theString$) -1)
  wend
'
end fn = theString$
'---------------------
local fn myUn$( theValue%)
  dim tempValue&
  dim 63 tempString$
'
  tempValue& = theValue
  if tempValue& <0 then tempValue& = tempValue& + 65536
'
  tempString$ = str$( tempValue&)
'
end fn = FN cleanString$( tempString$)
'---------------------

Use calling :
FN myUn$( yourNumber%)

jonathan