Click here to Skip to main content
15,897,226 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: UNICODE problem [modified] Pin
gabbana2-May-08 3:56
gabbana2-May-08 3:56 
GeneralRe: UNICODE problem Pin
David Crow2-May-08 4:24
David Crow2-May-08 4:24 
GeneralRe: UNICODE problem Pin
gabbana2-May-08 4:32
gabbana2-May-08 4:32 
GeneralRe: UNICODE problem Pin
gabbana2-May-08 4:49
gabbana2-May-08 4:49 
QuestionRe: UNICODE problem Pin
David Crow2-May-08 4:56
David Crow2-May-08 4:56 
GeneralRe: UNICODE problem Pin
marcinj2-May-08 9:12
marcinj2-May-08 9:12 
GeneralRe: UNICODE problem Pin
gabbana2-May-08 20:01
gabbana2-May-08 20:01 
GeneralRe: UNICODE problem Pin
marcinj3-May-08 11:44
marcinj3-May-08 11:44 
It actually all depends on the project requirements, but I suppose its better to create projects with UNICODE defined and keep your textual data in unicode format. Prefered in my opinion should be UTF-8 which uses less space.

If you are loading a text file you should somehow know its encoding type. If you are using Notepad to save text in Unicode format then file contains some extra information bytes about actual encoding type - it is easy to see them in binary file view. Some info on actual notepad format encoding can be found here:

http://blogs.msdn.com/michkap/archive/2007/04/22/2239345.aspx[^]

There are some other errors in your code that might be the cause of the errory you describe. For example ftell() return length of the file in bytes..., here is a code I got working quite well:

wchar_t *gg;

FILE *wfile;
wfile = _wfopen(L"c:\\ReadMe.txt",L"r");
fseek(wfile,0,SEEK_END);
int num = ftell(wfile);
fseek(wfile,2,SEEK_SET);

int buffSize = sizeof(wchar_t)*(num/2+1);
gg = (wchar_t*)malloc(buffSize);
memset(gg, 0, buffSize);
fread(gg,sizeof(wchar_t),(num-1)/2,wfile);
fclose(wfile);
QuestionNeed to load a directory without the User seeing it- How? Pin
Larry Mills Sr2-May-08 2:30
Larry Mills Sr2-May-08 2:30 
AnswerRe: Need to load a directory without the User seeing it- How? Pin
Hamid_RT2-May-08 2:40
Hamid_RT2-May-08 2:40 
AnswerRe: Need to load a directory without the User seeing it- How? [modified] Pin
_AnsHUMAN_ 2-May-08 2:41
_AnsHUMAN_ 2-May-08 2:41 
GeneralRe: Need to load a directory without the User seeing it- How? Pin
ThatsAlok5-May-08 0:09
ThatsAlok5-May-08 0:09 
AnswerRe: Need to load a directory without the User seeing it- How? Pin
Rajesh R Subramanian2-May-08 2:55
professionalRajesh R Subramanian2-May-08 2:55 
GeneralRe: Need to load a directory without the User seeing it- How? Pin
Larry Mills Sr2-May-08 6:46
Larry Mills Sr2-May-08 6:46 
GeneralRe: Need to load a directory without the User seeing it- How? Pin
ThatsAlok5-May-08 0:13
ThatsAlok5-May-08 0:13 
QuestionThe application failed to initialize properly (0x8000003) Pin
vijay.victory2-May-08 2:23
vijay.victory2-May-08 2:23 
AnswerRe: The application failed to initialize properly (0x8000003) Pin
Rajesh R Subramanian2-May-08 2:35
professionalRajesh R Subramanian2-May-08 2:35 
GeneralRe: The application failed to initialize properly (0x8000003) Pin
vijay.victory2-May-08 2:43
vijay.victory2-May-08 2:43 
AnswerRe: The application failed to initialize properly (0x8000003) Pin
Rajesh R Subramanian2-May-08 3:00
professionalRajesh R Subramanian2-May-08 3:00 
GeneralRe: The application failed to initialize properly (0x8000003) Pin
David Crow2-May-08 3:43
David Crow2-May-08 3:43 
AnswerRe: The application failed to initialize properly (0x8000003) Pin
Joan M2-May-08 3:55
professionalJoan M2-May-08 3:55 
GeneralRe: The application failed to initialize properly (0x8000003) Pin
David Crow2-May-08 4:26
David Crow2-May-08 4:26 
GeneralRe: The application failed to initialize properly (0x8000003) Pin
Joan M2-May-08 5:47
professionalJoan M2-May-08 5:47 
AnswerRe: The application failed to initialize properly (0x8000003) Pin
Mike Dimmick2-May-08 7:10
Mike Dimmick2-May-08 7:10 
QuestionList files and copy them from server [modified] Pin
Anorexic Tribble2-May-08 2:20
Anorexic Tribble2-May-08 2:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.