View unanswered posts | View active topics
|
Page 1 of 1
|
[ 4 posts ] |
|
Author |
Message |
epog10
|
Post subject: 1-byte ASCII ? Posted: Mon Jul 01, 2019 1:45 pm |
|
 |
User |
 |
Joined: Sat May 29, 2010 11:46 am Posts: 86 Location: UK
|
I write to a file opened as:- OpenFile(#DATNUM, "Name.dat", #PB_Ascii) character by character using:- WriteByte(#DATNUM, Asc(aCHAR))
I read it with:- ReadFile(#DATNUM, "Name.dat", #PB_Ascii) character by character using:- aCHAR = Chr(ReadByte(#DATNUM))
Why am I not getting the high ASCIIs as single bytes below 255?
In the following short test extract the 'h' characters have been replaces with chr(209) which should be Ñ but this is how it reads back from the file:- 1 32 2 A 65 3 n 110 4 o 111 5 t 116 6 65489 7 e 101 8 r 114 9 32 10 t 116 11 e 101 12 s 115 13 t 116 14 32 15 65489 16 e 101 17 r 114 18 e 101 19 32
Regard,
|
|
Top |
|
 |
wilbert
|
Post subject: Re: 1-byte ASCII ? Posted: Mon Jul 01, 2019 2:10 pm |
|
 |
PureBasic Expert |
 |
Joined: Sun Aug 08, 2004 5:21 am Posts: 3710 Location: Netherlands
|
Use ReadAsciiCharacter instead of ReadByte.
_________________ macOS 10.15 Catalina, Windows 10
|
|
Top |
|
 |
NicTheQuick
|
Post subject: Re: 1-byte ASCII ? Posted: Mon Jul 01, 2019 2:49 pm |
|
Joined: Sun Jun 22, 2003 7:43 pm Posts: 689 Location: Germany, Saarbrücken
|
Byte is signed and Ascii is unsigned.
_________________ The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
|
|
Top |
|
 |
epog10
|
Post subject: Re: 1-byte ASCII ? Posted: Mon Jul 01, 2019 3:24 pm |
|
 |
User |
 |
Joined: Sat May 29, 2010 11:46 am Posts: 86 Location: UK
|
Silly me!
Shows how rarely I use Purebasic!
Many thanks to both of you.
|
|
Top |
|
 |
|
Page 1 of 1
|
[ 4 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 47 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum
|