[fpc-pascal] Reading and writing char

David Emerson dle3ab at angelbase.com
Thu Oct 6 08:23:14 CEST 2011


On Wed 5 Oct 2011, Thomas Young wrote:
> Hi,
> 
> I'm trying to read and write ascii characters using FPC. I had no problems
> doing this years ago with Think Pascal & Code Warrior. 
> 
> For some reason I'm not able to read and write ascii characters above ascii
> 127 with FPC. Can someone explain this to me? 
> 
> Thanks in advance!

The world has changed, and globalization has reached your computer. Your 
computer is almost definitely using a different character set today than it was 
back in those days long ago. read this: 
http://www.joelonsoftware.com/articles/Unicode.html
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know 
About Unicode and Character Sets (No Excuses!)

~D.

> 
> Using this code:
> 	for i:= 33 to 226 do
> 		writeln('Character: ', chr(i), '   Ascii value: ', i:1);
> 
> Character: !   Ascii value: 33
> Character: "   Ascii value: 34
> Character: #   Ascii value: 35
> Character: $   Ascii value: 36
> Character: %   Ascii value: 37
> Character: &   Ascii value: 38
> Character: '   Ascii value: 39
> Character: (   Ascii value: 40
> Character: )   Ascii value: 41
> Character: *   Ascii value: 42
> Character: +   Ascii value: 43
> Character: ,   Ascii value: 44
> Character: -   Ascii value: 45
> Character: .   Ascii value: 46
> Character: /   Ascii value: 47
> Character: 0   Ascii value: 48
> Character: 1   Ascii value: 49
> Character: 2   Ascii value: 50
> Character: 3   Ascii value: 51
> Character: 4   Ascii value: 52
> Character: 5   Ascii value: 53
> Character: 6   Ascii value: 54
> Character: 7   Ascii value: 55
> Character: 8   Ascii value: 56
> Character: 9   Ascii value: 57
> Character: :   Ascii value: 58
> Character: ;   Ascii value: 59
> Character: <   Ascii value: 60
> Character: =   Ascii value: 61
> Character: >   Ascii value: 62
> Character: ?   Ascii value: 63
> Character: @   Ascii value: 64
> Character: A   Ascii value: 65
> Character: B   Ascii value: 66
> Character: C   Ascii value: 67
> Character: D   Ascii value: 68
> Character: E   Ascii value: 69
> Character: F   Ascii value: 70
> Character: G   Ascii value: 71
> Character: H   Ascii value: 72
> Character: I   Ascii value: 73
> Character: J   Ascii value: 74
> Character: K   Ascii value: 75
> Character: L   Ascii value: 76
> Character: M   Ascii value: 77
> Character: N   Ascii value: 78
> Character: O   Ascii value: 79
> Character: P   Ascii value: 80
> Character: Q   Ascii value: 81
> Character: R   Ascii value: 82
> Character: S   Ascii value: 83
> Character: T   Ascii value: 84
> Character: U   Ascii value: 85
> Character: V   Ascii value: 86
> Character: W   Ascii value: 87
> Character: X   Ascii value: 88
> Character: Y   Ascii value: 89
> Character: Z   Ascii value: 90
> Character: [   Ascii value: 91
> Character: \   Ascii value: 92
> Character: ]   Ascii value: 93
> Character: ^   Ascii value: 94
> Character: _   Ascii value: 95
> Character: `   Ascii value: 96
> Character: a   Ascii value: 97
> Character: b   Ascii value: 98
> Character: c   Ascii value: 99
> Character: d   Ascii value: 100
> Character: e   Ascii value: 101
> Character: f   Ascii value: 102
> Character: g   Ascii value: 103
> Character: h   Ascii value: 104
> Character: i   Ascii value: 105
> Character: j   Ascii value: 106
> Character: k   Ascii value: 107
> Character: l   Ascii value: 108
> Character: m   Ascii value: 109
> Character: n   Ascii value: 110
> Character: o   Ascii value: 111
> Character: p   Ascii value: 112
> Character: q   Ascii value: 113
> Character: r   Ascii value: 114
> Character: s   Ascii value: 115
> Character: t   Ascii value: 116
> Character: u   Ascii value: 117
> Character: v   Ascii value: 118
> Character: w   Ascii value: 119
> Character: x   Ascii value: 120
> Character: y   Ascii value: 121
> Character: z   Ascii value: 122
> Character: {   Ascii value: 123
> Character: |   Ascii value: 124
> Character: }   Ascii value: 125
> Character: ~   Ascii value: 126
> Character:    Ascii value: 127
> Character: ?   Ascii value: 128
> Character: ?   Ascii value: 129
> Character: ?   Ascii value: 130
> Character: ?   Ascii value: 131
> Character: ?   Ascii value: 132
> Character: ?   Ascii value: 133
> Character: ?   Ascii value: 134
> Character: ?   Ascii value: 135
> Character: ?   Ascii value: 136
> Character: ?   Ascii value: 137
> 
> truncated for brevity.
> 
> 
> Thomas Young
> mobile email: tygraphics at me.com
> 






More information about the fpc-pascal mailing list