Okay, here's the code as a independent C/C++ program: ===================================================== #include <iostream> using namespace std;
#define MSL 4096 char *colorize_string(const char *, const char *); int main() { const char *name = "Drizzle"; cout << colorize_string(name, "Rrw") << endl; return 0; } char *colorize_string (const char *name, const char *colors) { static char buf[MSL]; int pos = 0; int color_pos = 0; int up = 1; buf[0] = '\0'; if (!*name || !*colors) return buf; for (int i = 0; i < strlen(name); i++) { buf[pos++] = '&'; buf[pos++] = colors[color_pos]; if (color_pos >= strlen(colors) - 1) up = 0; else if (color_pos <= 0) up = 1; if (up) color_pos++; else color_pos--; buf[pos++] = name[i]; } buf[pos] = '\0'; return buf; } ===================================================== [EMAIL PROTECTED] jehill]$ ./a.out &RD&rr&wi&rz&Rz&rl&we You'll need to change a few things: make 'int up' into a boolean (if you want), add a check to ensure name and the color fields are not too long. I know this is still not what you want. I provide this code as a lesson for your own perusal. If you can't quite figure out how to make it colorize the name how you'd like it, mail again and I'll send a few pointers. Here's a hint: Get the strlen of the name and divide up each part of the color field into blocks. From what I can tell, you only want: Namename N am en am e What about 9+ character names, or ones with 3, 5? What exactly do you want the rest to look like? If I'm mistaken (my magical crystal orb is malfunctioning at the moment), please correct me.