tags:

views:

54

answers:

1

Hello friends,,I am not able to read the contents in the file if I manually write something in the file...If there are contents existing already am able to read the contents...but if I go and manually write something in the file and try to read I am not able to read the contents that I have edited..check the code below that I am using to read....

CFile file;
if(file.open("C:\\users\\rakesh\\Desktop\\myText.txt",CFile::modeRead))
{ 
return false;
}
TCHAR buffer[50];//say content is small
file.read(buffer,50);
file.close();
+1  A: 

Looks like an unicode-problem. My guess is that your project is set to use unicode, but your editor writes ascii.

dwo
okay..If I read the contents as char it should work right...
kiddo
I actually tried to check that and YES what u said was correct..its reading when its in char but not when tried as TCHAR...so how can i fix the problem...I would really appreciate if u help me
kiddo
If the file you need to read is unicode, you just have to use an editor which can read and write unicode. Otherwise, set your project settings to !unicode and use char instead of TCHAR.
dwo