开发者

How to redefine large amounts of data quickly [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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 & ")"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜