Hi!
The following example for reading in and viewing a file is listet in the. DOC-Files (Advanced Section) of Epoc Release 5 (ER5), which came with the ER6-Developer-Tool.
If I run this on the the Nokia 9210 (=ER6),
I�m getting Error-Code -134, meaning Bad Allignment.
I think that�s coming because I�m trying to open a file
which is in Unicode-Format (as most of the file under ER6)
Can someone please alter the example, so it can be run
under ER6:
Example � displaying a plain text file
This program opens a plain text file � such as one created with the Export as text option in the File menu of the Program editor � and types it to the screen. Press Esc to quit and any other key to pause the typing to the screen.
PROC ioType:
LOCAL ret%,fName$(128),txt$(255),address&
LOCAL handle%,mode%,k%
PRINT "Filename?", :INPUT fName$ : CLS
mode%=$0400 OR $0020 REM open=$0000,text=$0020,share=$0400
ret%=IOOPEN(handle%,fName$,mode%)
IF ret%<0
showErr😞ret%)
RETURN
ENDIF
address&=ADDR(txt$)
WHILE 1
k%=KEY
IF k% REM if keypress
IF k%=27 REM Esc pressed
RETURN REM otherwise wait for a key
ELSEIF GET=27
RETURN REM Esc pressed
ENDIF
ENDIF
ret%=IOREAD(handle%,address&+1,255)
IF ret%<0
IF ret%<>-36 REM NOT EOF
showErr😞ret%)
ENDIF
BREAK
ELSE
POKEB address&,ret% REM leading byte count
PRINT txt$
ENDIF
ENDWH
ret%=IOCLOSE(handle%)
IF ret%
showErr😞ret%)
ENDIF
PAUSE -100 :KEY
ENDP
PROC showErr😞val%)
PRINT "Error",val%,err$(val%)
GET
ENDP
More Infos about Unicode-File-Access can be found in the
"Crystal v6.00 OPL Porting Guide.doc", which comes with the OPL Developer-Pack for the 9210. This Document covers very important
information for all who want to programm OPL on the 9210 / ER6.
Cheers!
Luzie