Skip to main content
gamedev.net
🔒 Locked

Message error strings

Started by Silly_con May 10, 2004 at 4:56 PM 0 replies 150+ views
Original Post
Silly_con
Silly_con
I want to have strings, that represents messages, (error messages, or simple messages) accesing it in a way like this: error.MESSAGE_NOFILE that will be equal to "There is no file." I have tried with a struct called error, with static const char*: struct error { static const char *MESSAGE_NOFILE = "There is no file."; ... }; but with this I get errors, anyone knows how I can do this ? I prefer not to create and object of the struct/class, and later accesing it, I want something like java constants ( Integer.ANY_CONSTANT)
Aprosenf
Aprosenf
struct error
{
static const char MESSAGE_NOFILE[];
};

const char MESSAGE_NOFILE[] = "There is no file;"


Then, to access it, write error::MESSAGE_NOFILE, i.e. use a double colon, not a dot.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.