iansjack wrote:
Have you looked at the input file with a hex editor? It’s possible that, somehow, a non-printing character has slipped in which is upsetting things.
I did. There doesn't seem to be anything wrong with it (on my end anyway):
Code:
$ xxd code.txt
Code:
00000000: 7072 6f67 7261 6d20 636f 6465 3b0a 0a76 program code;..v
00000010: 6172 2078 2c79 2c73 756d 3a69 6e74 6567 ar x,y,sum:integ
00000020: 6572 3b0a 7661 7220 413a 696e 7465 6765 er;.var A:intege
00000030: 723b 0a0a 7072 6f63 6564 7572 6520 5375 r;..procedure Su
00000040: 6d41 7667 2850 312c 5032 3a69 6e74 6567 mAvg(P1,P2:integ
00000050: 6572 3b20 7661 7220 4176 673a 696e 7465 er; var Avg:inte
00000060: 6765 7229 3b0a 7661 7220 733a 696e 7465 ger);.var s:inte
00000070: 6765 723b 0a62 6567 696e 0a20 2020 2073 ger;.begin. s
00000080: 3a3d 5031 2b50 323b 0a20 2020 2073 756d :=P1+P2;. sum
00000090: 3a3d 733b 0a20 2020 2041 7667 3a3d 7375 :=s;. Avg:=su
000000a0: 6d2f 323b 0a65 6e64 3b0a 0a62 6567 696e m/2;.end;..begin
000000b0: 0a20 2020 2078 3a3d 353b 0a20 2020 2079 . x:=5;. y
000000c0: 3a3d 373b 0a20 2020 2053 756d 4176 6728 :=7;. SumAvg(
000000d0: 782c 792c 4129 3b0a 656e 642e 0a x,y,A);.end..
For some reason, that view has characters that don't seem to actually exist:
Code:
$ xxd -i code.txt
Code:
unsigned char code_txt[] = {
0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x63, 0x6f, 0x64, 0x65,
0x3b, 0x0a, 0x0a, 0x76, 0x61, 0x72, 0x20, 0x78, 0x2c, 0x79, 0x2c, 0x73,
0x75, 0x6d, 0x3a, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3b, 0x0a,
0x76, 0x61, 0x72, 0x20, 0x41, 0x3a, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65,
0x72, 0x3b, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x75, 0x72,
0x65, 0x20, 0x53, 0x75, 0x6d, 0x41, 0x76, 0x67, 0x28, 0x50, 0x31, 0x2c,
0x50, 0x32, 0x3a, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3b, 0x20,
0x76, 0x61, 0x72, 0x20, 0x41, 0x76, 0x67, 0x3a, 0x69, 0x6e, 0x74, 0x65,
0x67, 0x65, 0x72, 0x29, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x20, 0x73, 0x3a,
0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x3b, 0x0a, 0x62, 0x65, 0x67,
0x69, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x3a, 0x3d, 0x50, 0x31,
0x2b, 0x50, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x75, 0x6d,
0x3a, 0x3d, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x41, 0x76, 0x67,
0x3a, 0x3d, 0x73, 0x75, 0x6d, 0x2f, 0x32, 0x3b, 0x0a, 0x65, 0x6e, 0x64,
0x3b, 0x0a, 0x0a, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x0a, 0x20, 0x20, 0x20,
0x20, 0x78, 0x3a, 0x3d, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x79,
0x3a, 0x3d, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x53, 0x75, 0x6d,
0x41, 0x76, 0x67, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x41, 0x29, 0x3b, 0x0a,
0x65, 0x6e, 0x64, 0x2e, 0x0a
};
unsigned int code_txt_len = 221;
Maybe I'm misinterpreting the hex dump though...