On Sat, 18 Sep 2004 01:15:39 -0700, Alan Pong wrote:
#define PIC1 "pic1.gif"
#define PIC2 "pic2.gif"
:
:
#define PIC999 "pic999.gif"
any shortcut/trick/preprocessor directive/operator can do above easily?
What are you really trying to do? What is the problem the above is
attempting to solve?
// Untested, and my macro-fu is seriously weak
#define PIC(x) "pic" #x ".gif"
// Unsure of efficiency of ostringstream, but otherwise better, IMO
#include <string>
#include <sstream>
inline
std::string pic(int x) {
std::ostringstream buffer;
buffer << "pic" << x << ".gif";
return buffer.str ();
}
--
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution.