I need a c++ program which will read a unicode format file and store in another file.Before reading the file the program should able to check whether the file is in unicode format or not.if not no need to read and store.
I never worked on unicode file ,so i do not know how to deal with it.
Please any one can help me!!!Its urgent.
Here is the code what i have tried but i dont know whether it exactly doing the job or not.As i am no clear idea about the multi-byte foramt file,so i am not getting the things exactly.
#include <iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
wchar_t ch;
FILE *fp;
wchar_t *buffer = (wchar_t *)malloc(sizeof(wchar_t) * 1);
fp = fopen("in.txt","rb");
if( fp == NULL)
{
printf("Error: File cannot be access/opened\n");
getchar();
return 1;
}
else
{
while(fread(buffer,sizeof(wchar_t),1,fp) != 0)
printf("%s",buffer);
fclose(fp);
}
system("PAUSE");
return 0;
}
Thanx in Advance
Regards
Samir
This post has been edited by samirpadhy: 08 June 2009 - 11:31 PM

New Topic/Question
Reply



MultiQuote





|