Monday, July 24, 2006

allbn2unicode

i have started a project called allbn2unicode


#include stdio.h
#include stdlib.h
#include string.h
#include wchar.h
#include locale.h
#include langinfo.h

int main(int argc, char *argv[])
{
FILE *fp;
FILE *fp2;
wchar_t wr[80];
wchar_t *wca;
wchar_t hex,*hex2;
char str[80],*store;
int i,len;

/* set locale for bangla */
setlocale(LC_ALL, "bn_BD.UTF-8");

store = str;

wca = wr;

if(argc!=3){
printf("name \n");
exit(1);
}

if((fp = fopen(argv[1], "r")) == NULL) {
printf("Cannot open file.\n");
exit(1);
}

fgetws(wca, 100, fp);

/* if(fread(store,sizeof(store),1, fp) !=1) {
printf("Cannot open file.\n");
exit(1);
} */

/* optional for asci file mbstowcs(wca, store,20);*/

fclose(fp);

if((fp2 = fopen(argv[2], "wb")) == NULL) {
printf("Cannot write file.\n");
}

if(wr[0]==0x0985)
{
hex=0x0987;
}
else

hex=0x0985;

fputws(wca,fp2);

fclose(fp2);

return 0;
}

No comments: