reading any file

hi,all

I'm new to c++ and I want to read any file byte byte and then get the ASCII code fore each file.

I searched in Google and also search this forum but I couldn't find any thing useful.

that's what I did until now but unfourtonatly it doesn't works.
1
2
3
4
istream myfil("F:\\2nd year_2\\Data structure 2\\books\\New Text Document");
char ch;
myfil.get(ch);
cout<<(int )ch<<endl;	 


negative number will be printed and when I casted it to unsigned int,it will very big number greater than 256

Thanks in advance
Make sure the file was actually opened:
 
if(myfile.is_open())
the same problem again
Hm...is the file empty?
no ya
Topic archived. No new replies allowed.