naides
December 31st, 2012, 19:12
lemme see
I know
HAPPY 2013
Hard luck, every one
I know
HAPPY 2013
Hard luck, every one
View Full Version : Some thing was missing in the board. . .?
[Originally Posted by blabberer;93958] Wishing You All A Very Very Happy New Year |
#include <stdio.h>
#include <windows.h>
int main(int argc, char* argv[])
{
char *outbuff,*transform;
char *color[] = {"violet", "indigo", "blue", "green", "yellow","orange","red", NULL };
if (argc != 2)
{
printf(
"Provide a string argument in double quotes for conversion\n"
"Raibowstring.exe \"Wish You Success\"\n";
return FALSE;
}
int instrlen = strlen(argv[1]), count=0 , i = 0;
if ( (( outbuff = (char *)malloc(50*instrlen)) == 0) || (( transform = (char *)malloc(0x100)) == 0))
{
printf("malloc failed\n";
return FALSE;
}
memset(outbuff,0,(50*instrlen));
memset(transform,0,0x100);
while (count < instrlen)
{
for (i = 0; i< 7; i++)
{
if(argv[1][count] != NULL)
{
sprintf_s(transform,0x50,"%c",color[I],argv[1][count]);
strncat_s(outbuff,2100,transform,2100);
count++;
}
}
}
printf("%s\n",outbuff);
free(outbuff);
free(transform);
return 0;
}