Recent posts

#71
OxygenBasic Examples / Re: Unicode question
Last post by Charles Pegge - June 04, 2024, 12:41:05 AM
ok, start with something really simple:

putfile "t.txt","AA" 'cheating!
wstring ws
ws=cast wstring getfile("t.txt")
print ws
#72
OxygenBasic Examples / Re: Unicode question
Last post by Frank Brübach - June 03, 2024, 09:55:56 PM
Sorry No Chance same result Like before No Chinese Symbols are displayed

uses corewin

''  Try splitting this dim line:
 ''  wstring txt=wstring getfile "chines.txt"

'' wstring txt
'' txt=wstring getfile "chines.txt"
'or
' txt= cast wstring getfile "chines.txt"

''print txt

wstring hellochinese
 
sub getwstrings()
   'very simple
   int n=0
   int p1=1, p2, le
   wstring wcrlf=wchr(13)+wchr(10)
 
   wstring txt
   txt=wstring getfile "chines.txt"
   if len(txt)=0 then mbox "Cannot load chines.txt"
   while 1
     p2=instr(p1,txt, wcrlf)
     if p2=0 then exit while
     le=p2-p1+1
     n+=1
     hellochinese=mid(txt,p1,le)
     p1=p2+2     
     print hellochinese
   wend
end sub

getwstrings()
#73
OxygenBasic Examples / Re: Unicode question
Last post by Charles Pegge - June 03, 2024, 09:06:53 PM
Try splitting this dim line:

 wstring txt=wstring getfile "chines.txt"

wstring txt
txt=(wstring) getfile "chines.txt"
'or
' txt= cast wstring getfile "chines.txt"
#74
microA Interpreter / Re: micro(A) progies
Last post by Zlatko Vid - June 03, 2024, 08:52:00 PM
...elegant translation from me-myself-and-I  ;D
#75
OxygenBasic Examples / Re: Unicode question
Last post by Frank Brübach - June 03, 2024, 08:20:47 PM
Made this example Charles
But the Chinese Text isnt displayed correct

wstring hellochinese
 
sub getwstrings()
  'very simple
  int n=0
  int p1=1, p2, le
  wstring wcrlf=wchr(13)+wchr(10)
 
  wstring txt=wstring getfile "chines.txt"
  if len(txt)=0 then mbox "Cannot load chines.txt"
  while 1
    p2=instr(p1,txt, wcrlf)
    if p2=0 then exit while
    le=p2-p1+1
    n+=1
    hellochinese=mid(txt,p1,le)
    p1=p2+2   
    print hellochinese
  wend
end sub
 
getwstrings()


Chinese.txt ' Hope this can displayed Here correct

你好吗 these are chinese letters

   
#76
OxygenBasic Examples / Re: Cast example
Last post by Charles Pegge - June 03, 2024, 06:43:17 PM
in o2, byte and ubyte are unsigned, sbyte is signed. You can also cast as char:

int a=43
print cast byte a  '43'  same as ubyte
print cast char a  '+'
#77
OxygenBasic Examples / Cast example
Last post by Frank Brübach - June 03, 2024, 01:53:37 PM
I dont know If there's any Cast example for oxygen but I noticed its Working perfect with sbyte

'' cast example (freebasic) and oxygen translation
''
uses console

sbyte sb 'signed byte
sb=32.2
print " 32.2 "+sb ' result 32


'' freebasic
'' Print Cast( Byte, &h0080 ) '-128 ''

'' oxygen
''
sb=byte(&h0080)
print " byte ="+sb ' result: -128


'' will print 3 because the floating-point value will be converted to an Integer
'' (this Casting operator is equivalent to using CInt)
''
'' Print Cast( Integer, 3.1 ) '3

'' oxygen
''

sb=integer(3.1)
print " integer 3.1 =" + sb ' result: 3

wait
#78
OxygenBasic Examples / Unicode question
Last post by Frank Brübach - June 03, 2024, 01:23:17 PM
Hello Charles..

How I can Display Chinese Letters in oxygen? In Oxide there are only to See ??? Three or more  Questionmarks

In my simple Texteditor it Shows correct Chinese Symbols

uses corewin

extern lib "User32.dll"
    ! CharUpper "CharUpperW"                        '1
    ! CharLower "CharLowerW"                        '1
    ! MessageBox            "MessageBoxW"           '1
end extern
     
    wstring tab=wchr(9)
    wstring sep

dim strx as string =" 你好吗 " '' chinese letters

mbox mid(**strx,2)

' unicode problem

" 你好吗 "
' translation: chinesisch: Nǐ hǎo ma
' english: hello how are you?
' german: "hallo wie gehts?"
 

#79
General Discussion / Teenager gifted with a super-p...
Last post by Charles Pegge - June 03, 2024, 11:46:06 AM
MEET A CANADIAN TEEN GIFTED WITH A SUPER-POWERED MEMORY | W5 INVESTIGATION

Official W5
24 mar 2024

#80
microA Interpreter / micro(A) progies
Last post by Zlatko Vid - June 03, 2024, 10:41:26 AM
for testing..

'usr func test 3 /locals
mode 1 : wcolor 0,0,0 : fcolor 150,210,150
print 10,20,"usr func test_3 /locals in micro(A)" : swap

func mA(var res)
    var a,b,c
    a=20
    b=40
    c=a*b
    fcolor 250,210,150 : print 50,50,c : swap
endfn

'call fn mA()
mA()