void main()
{
int i = 0;
char data = 'o';
char * ptr_to_data = &data;
ifstream file ("example.txt",ios::in|ios::binary);
while( !file.eof() )
{
i++;
file.read(ptr_to_data,1);
cout<<data<<endl;
}
cout<<i<<endl;
file.close();
return;
}
computer beeps at me for this, what am i doing wrong ?
Because you're outputting the file data as well, and some of those bytes (the ones with a value of 7) are interpreted by the console as beeps rather than as printable symbols.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement