mikeage.net Logo
mikeage.net/2006/10/03/

mikeage.net @ י"ד תשרי תשס"ט

Archive for י"ב תשרי תשס"ז - October 3, 2006

Creating an array of strings for an enum

י"ב תשרי תשס"ז - October 3, 2006

A common issue in writing C based test tools is the desire to be able to show a user a list of all enums. This, of course, is technically impossible, as the mapping from enum to int is one way only. However, the following trick lets you create a two dimensional character array who's index is the enum (cast to int, to be pedantic) is an index to a string containing the name of the enum.
(more...)

Quick Map
Content +
Personal +
Archives +
Site Stuff +
RBS Weather +
Search +
New Images
Visitors
Clustermap
Blogroll

Valid XHTML 1.1!
Printer Friendly Page
 

Last Modified: September 04, 2006 @ 05:11 CST