I'm currently writing an ASCII Command Prompt game engine and I am not sure how to redefine 256+ ASCII chars quickly. I am not up to the job of learning all 256 codes.
I was going about having a separate file开发者_运维问答 with the variables to save space, but honestly I'm not upto the job of writing this:
char ascii_null = char(0);
differently 256 times.
The standard methods are to use #define or const to provide a name to values. These will more efficient since you won't be changing the values after you define them.
#define ascii_null char(0)
#define ascii_bell char(7)
or
const char ascii_null = char(0);
const char ascii_bell = char(7);
The easiest way to write those lines would be to copy a table from say here and pasting it into Excel. Then use Excel to build the lines with a formula: ="const char ascii_" & A1 & " = char(" & B1 & ")"
精彩评论