C program to generate codes for coloured text chat on Facebook

Hi guys. Few days back when I wrote the article Send Coloured Text in Facebook Chat  then people start complainting that its really difficult to find and write the code everytime because you have to look for each alphabet.
It become even more difficult when it comes to long text. I think its one of the reasons that the coloured text chat is less popular among facebook users.
To overcome this issue my logical mind suggested me again to write a code for the task of searching and generating the code for alphabets and even for large messages.
I haven't posted anything related with programming for such a long time, so here it is. Have fun folks, enjoy the code.

Follow the Steps:
  • Open notepad > copy the below code:

#include<stdio.h>
#include<conio.h>
#include<process.h>   
int main()
{
FILE *ptr;
char A[100],*ch;
int i,j;
clrscr();


/* Taking input Message */
printf("\n\n\t By Gaurav Singh. All Rights Reserved.");
printf("\n\n\n\n\n\t Enter Your Message: ");
gets(A);
 i=0;


/* Checking the Errors */
while(A[i]!='\0')
{
 j=A[i];
 if( (j<65&&j!=32) || j>122 || (j<97&&j>90)  )
 {
  printf("\n\n\n\n\n\t\t ERROR !! Only space ' ' and alphabets are allowed ");
  getch();
  exit(0);
 }
 i++;
}


/* Adjust the lower case to upper case letters */
for(i=0;A[i]!='\0';i++)
{
 j=A[i];
 if(j>96&&j<123)
   A[i]=A[i]-32;
}




/* Generating the codes & writing into the file */
ptr=fopen("codes.txt","w");
for(i=0;A[i]!='\0';i++)
{
 switch(A[i])
 {
  case 'A':
  ch="[[107015582669715]] ";
  break;
  case 'B':
  ch="[[116067591741123]] ";
  break;
  case 'C':
  ch="[[115602405121532]] ";
  break;
  case 'D':
  ch="[[112542438763744]] ";
  break;
  case 'E':
  ch="[[115430438474268]] ";
  break;
  case 'F':
  ch="[[109225112442557]] ";
  break;
  case 'G':
  ch="[[111532845537326]] ";
  break;
  case 'H':
  ch="[[111356865552629]] ";
  break;
  case 'I':
  ch="[[109294689102123]] ";
  break;
  case 'J':
  ch="[[126362660720793]] ";
  break;
  case 'K':
  ch="[[116651741681944]] ";
  break;
  case 'L':
  ch="[[115807951764667]] ";
  break;
  case 'M':
  ch="[[106596672714242]] ";
  break;
  case 'N':
  ch="[[108634132504932]] ";
  break;
  case 'O':
  ch="[[116564658357124]] ";
  break;
  case 'P':
  ch="[[111669128857397]] ";
  break;
  case 'Q':
  ch="[[107061805996548]] ";
  break;
  case 'R':
  ch="[[106699962703083]] ";
  break;
  case 'S':
  ch="[[115927268419031]] ";
  break;
  case 'T':
  ch="[[112669162092780]] ";
  break;
  case 'U':
  ch="[[108983579135532]] ";
  break;
  case 'V':
  ch="[[107023745999320]] ";
  break;
  case 'W':
  ch="[[106678406038354]] ";
  break;
  case 'X':
  ch="[[116740548336581]] ";
  break;
  case 'Y':
  ch="[[112416755444217]] ";
  break;
  case 'Z':
  ch="[[165724910215]] ";
  break;
  default:
  ch="";
 }


fputs(ch,ptr);
}
fclose(ptr);


clrscr();


printf("\n\t The code is saved in the file codes.txt");
printf("\n\n\n\t Have Fun.!!");
printf("\n\n\n\t Ping me at gauravthehacker13@gmail.com for any help");
getch();
return 0;
}


  • Now compile this code and generate its exe. If you don't know how to compile the look here
  • Alternatively, you can directly download the code and its exe from here. It is compiled on Windows7 (32 dit) with borland C compiler.
How it Works:
  • Suppose the generated exe file is chat.exe. Clike on this file.
  • Now enter your message for which you want to generate the code. Remember use only alphabets and spaces ' '. Hit Enter when done.
  • Then look for codes.txt in the same folder where chat.exe is present.
  • This file contains the final generated codes for you message.
  • Just copy and paste them in the chat box.

All Rights Reserved.

Keep Coding. Keep Rocking :)
Previous
Next Post »